What's new
MythicLib

MythicLib 2021-03-15

Versions
  1. 1.13
  2. 1.14
  3. 1.15
  4. 1.16
Description
This resource is a hard dependency for MMOItems Premium and MMOCore. Since these plugins share a lot of similar features, we have decided to merge the most important RPG mecanics from MMOItems and MMOCore into one single library, in order to make implementing new features and keeping track of bugs easier. The idea is to keep MMOItems and MMOCore standalone while allowing extra compatibility when they are used together. Merging some of the plugin systems together also makes it much easier for extra addons to be developped against MMO plugins.

Source Code | Issue Tracker | Documentation

Features that were implemented in MMOItems and/or MMOCore thanks to MythicLib:
  • skill and weapon critical strikes (chance and power)
  • mitigation mechanics (block, parry, dodge)
  • player stats like % PvE/PvP/Undead Damage
  • all these stats work for both MMOCore and MMOItems skills and weapons
  • much more soon!
Although MythicLib is a hard dependency for both plugins, MMOItems and MMOCore remain completely standalone, which means you don't need any plugin other than MythicLib to run MMOItems or MMOCore.

Critical Strikes
Both physical and magical attacks have a set amount of chance to deal a critical strike which increases final damage dealt. The Critical Strike Power stat increases damage dealt by either physical or magical (two separate stats) critical strikes.

Damage Mitigation
When blocking an attack, the player negates a set percentage of the attack damage depending on the player's block power. The higher the player's block rating, the higher the chance to block any attack.

When dodging an attack, the player quickly leaps backward and negates all the attack damage. The higher the player's dodge rating, the higher the chance to dodge any attack.

When parrying an attack, the player negates all the attack damage and deals knockback to the attacker in case of a melee attack. The higher the player's parry rating, the higher the chance to parry an attack.

Damage System
MMOItems and MMOCore have their own damage system which extends the vanilla damage calculation system. There are five different damage types although most of them are incompatible. Any attack cannot have more than 3 damage types.
  • Physical or magical attacks
  • Weapon or skill damage
  • Projectile based damage
e.g: a bow weapon deals weapon-projectile-physical damage while a fireball skill deals magic-skill damage. You cannot have an attack deal <magical and physical>, or <weapon and skill> damage at the same time.

The final attack damage therefore depends on the attack damage types and on the player statistics. These stats can be granted by classes and party bonuses from MMOCore, by items and set bonuses from MMOItems, etc. You can also add temporary stat modifiers using the MythicLib stat API!

Extra debug tool: attribute explorer (1.13+)
MythicLib also features an extra debug tool for server admins which lets them control their vanilla player attributes like max health, armor, movement speed... The GUI can be accessed using /exploreattributes <player> and may be used to monitor your attribute modifiers which can really get handy at times. Be careful not to add glitchy attribute modifiers that could e.g get your health bar below 0 as this can damage your player data.
n1w45Wv.png

Main API features
By retrieving a player's StatMap you can modifiy its stats by adding stat modifiers. You may add a flat stat modifier (increases a stat by a set value) or a relative stat modifier (increases stat value by X%).
Code:
MMOPlayerData mmodata = MMOPlayerData.get(#player instance#);
StatMap stats = mmodata.getStatMap();
# the SharedStat util class lists public MMOCore/MMOItems stats
StatInstance instance = stats.getInstance(SharedStat.ATTACK_DAMAGE);

# add modifiers
instance.addModifier("pluginKey", new StatModifier(10, ModifierType.FLAT));
instance.addModifier("pluginKey", new StatModifier(20, ModifierType.RELATIVE));

The NBTItem class is an util class you can use to manipulate an item's NBTTags.
Code:
NBTItem nbt = NBTItem.get(#itemStackInstance#);
String mmoitemsTypeTag = nbt.getString("MMOITEMS_ITEM_TYPE");
nbt.removeTag("Unbreakable");
nbt.addTag(new ItemTag("CustomModelData", 1))
ItemStack result = nbt.toItem();

The PlayerAttackEvent bukkit event is called whenever a player deals damage to another entity (melee attack, MMOItems item abilities, MMOCore skills, projectiles like snowballs, tridents..). This event is cancelable and you can edit the output damage.
Code:
AttackResult result = event.getAttack();
double damage = result.getDamage();
Set<DamageType> damageTypes = result.getTypes();
// ...

Config
You can configurate a few options like critical strike coefficients, mitigation stats and player messages.
Code:
# Make sure you restart/reload your server when changing one of
# these options.MythicLib/MMOItems/MMOCore are /reload friendly
# but that might not be the case for all the plugins you're using.

# Default: 2.0; crits deal twice as much damage. This value
# stacks up with the current weapon's crit power.
#
# Example:
# - 10 atk damage sword
# - +50% crit power
# - crit coefficient set to 2.0
# result: 25 damage (10 + 10 + 5)
crit-coefficient: 2.0

# Same but for skill damage.
spell-crit-coefficient: 1.5

# Default and max. values of armor stats. These systems
# all have a cooldown which can be reduced using the
# '*** Cooldown Reduction' item stat.
mitigation:

    # Edit mitigation messages here. Leavy blank for no message.
    message:
        action-bar: true
        parry: '&cYou just parried #damage# damage.'
        # Use #power# to display block power.
        block: '&cYou just blocked #damage# damage.'
        dodge: '&cYou just dodged #damage# damage.'

    block:
        power:
            default: 25.0
            max: 75.0
        rating-max: 80.0
        cooldown:
            base: 5.0
            min: 10.0
    dodge:
        knockback:
            enabled: true
            force: 1.0
        rating-max: 80.0
        cooldown:
            base: 5.0
            min: 1.0
    parry:
        knockback:
            enabled: true
            force: 1.0
        rating-max: 80.0
        cooldown:
            base: 8.0
            min: 2.0
  • Like
Reactions: EINF0LK
Author
MythicCraft
Downloads
3,327
Views
21,577
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from MythicCraft

Top