mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Cap attack amount and fixed alicorn amulet being damageable.
This commit is contained in:
parent
6f725bb64c
commit
8d1a7ea400
1 changed files with 5 additions and 1 deletions
|
@ -52,6 +52,7 @@ public class ItemAlicornAmulet extends ItemArmor implements IDependable {
|
||||||
|
|
||||||
setTranslationKey(name);
|
setTranslationKey(name);
|
||||||
setRegistryName(domain, name);
|
setRegistryName(domain, name);
|
||||||
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -197,7 +198,7 @@ public class ItemAlicornAmulet extends ItemArmor implements IDependable {
|
||||||
if (world.rand.nextInt(300) == 0) {
|
if (world.rand.nextInt(300) == 0) {
|
||||||
DamageSource source = MagicalDamageSource.causePlayerDamage("alicorn_amulet", player);
|
DamageSource source = MagicalDamageSource.causePlayerDamage("alicorn_amulet", player);
|
||||||
|
|
||||||
player.attackEntityFrom(source, 0.5F);
|
player.attackEntityFrom(source, 1F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,9 +211,12 @@ public class ItemAlicornAmulet extends ItemArmor implements IDependable {
|
||||||
float attachedTime = player.getInventory().getTicksAttached(this) / 100F;
|
float attachedTime = player.getInventory().getTicksAttached(this) / 100F;
|
||||||
|
|
||||||
DamageSource source = MagicalDamageSource.causePlayerDamage("alicorn_amulet", player.getOwner());
|
DamageSource source = MagicalDamageSource.causePlayerDamage("alicorn_amulet", player.getOwner());
|
||||||
|
|
||||||
DifficultyInstance difficulty = player.getWorld().getDifficultyForLocation(player.getOrigin());
|
DifficultyInstance difficulty = player.getWorld().getDifficultyForLocation(player.getOrigin());
|
||||||
float amount = (attachedTime * (1 + needfulness)) * (1 + difficulty.getClampedAdditionalDifficulty());
|
float amount = (attachedTime * (1 + needfulness)) * (1 + difficulty.getClampedAdditionalDifficulty());
|
||||||
|
|
||||||
|
amount = Math.min(amount, player.getOwner().getMaxHealth());
|
||||||
|
|
||||||
player.getOwner().attackEntityFrom(source, amount);
|
player.getOwner().attackEntityFrom(source, amount);
|
||||||
|
|
||||||
if (attachedTime > 120) {
|
if (attachedTime > 120) {
|
||||||
|
|
Loading…
Reference in a new issue