|
|
|
|
@ -5,7 +5,9 @@ import lotr.common.entity.npc.LOTRHiredNPCInfo;
|
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import net.minecraft.entity.SharedMonsterAttributes;
|
|
|
|
|
import net.minecraft.entity.ai.attributes.IAttribute;
|
|
|
|
|
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
|
|
|
|
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
|
|
|
|
import net.minecraft.entity.item.EntityFireworkRocket;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
|
@ -19,6 +21,7 @@ import net.minecraft.world.World;
|
|
|
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
|
|
|
import org.spongepowered.asm.mixin.Overwrite;
|
|
|
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
|
|
|
import org.spongepowered.asm.mixin.Unique;
|
|
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
@ -30,11 +33,18 @@ public class MixinLOTRHiredNPCInfo {
|
|
|
|
|
private UUID hiringPlayerUUID;
|
|
|
|
|
@Shadow
|
|
|
|
|
public int xpLevel = 1;
|
|
|
|
|
@Unique
|
|
|
|
|
public int levelUpCounter = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author
|
|
|
|
|
* @reason
|
|
|
|
|
*/
|
|
|
|
|
@Overwrite(remap = false)
|
|
|
|
|
public void onLevelUp() {
|
|
|
|
|
EntityPlayer hirer;
|
|
|
|
|
this.addLevelUpHealthGain((EntityLivingBase) this.theEntity);
|
|
|
|
|
rotateLevelUpStat();
|
|
|
|
|
|
|
|
|
|
Entity mount = this.theEntity.ridingEntity;
|
|
|
|
|
if (mount instanceof EntityLivingBase && !(mount instanceof LOTREntityNPC)) {
|
|
|
|
|
this.addLevelUpHealthGain((EntityLivingBase)mount);
|
|
|
|
|
@ -45,6 +55,35 @@ public class MixinLOTRHiredNPCInfo {
|
|
|
|
|
this.spawnLevelUpFireworks();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void rotateLevelUpStat() {
|
|
|
|
|
EntityLivingBase entity = (EntityLivingBase) this.theEntity;
|
|
|
|
|
|
|
|
|
|
switch (levelUpCounter) {
|
|
|
|
|
case 0:
|
|
|
|
|
// +1 HP
|
|
|
|
|
this.addLevelUpHealthGain(entity);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
// +0.25 Damage
|
|
|
|
|
this.increaseDamageGain(entity);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
// +0.005 movement Speed
|
|
|
|
|
this.increaseMovementGain(entity);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
// +0.1 knockback resistance
|
|
|
|
|
this.increaseKnockbackGain(entity);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
levelUpCounter = (levelUpCounter +1) % 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author
|
|
|
|
|
* @reason
|
|
|
|
|
*/
|
|
|
|
|
@Overwrite(remap = false)
|
|
|
|
|
public void addLevelUpHealthGain(EntityLivingBase gainingEntity) {
|
|
|
|
|
float healthBoost = 1.0f;
|
|
|
|
|
@ -53,6 +92,28 @@ public class MixinLOTRHiredNPCInfo {
|
|
|
|
|
gainingEntity.heal(healthBoost);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void increaseDamageGain(EntityLivingBase gainingEntity) {
|
|
|
|
|
float damageBoost = 0.25f;
|
|
|
|
|
IAttributeInstance attribute = gainingEntity.getEntityAttribute(LOTREntityNPC.npcAttackDamage);
|
|
|
|
|
attribute.setBaseValue(attribute.getBaseValue() + (double)damageBoost);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void increaseMovementGain(EntityLivingBase gainingEntity) {
|
|
|
|
|
float movementBoost = 0.005f;
|
|
|
|
|
IAttributeInstance attribute = gainingEntity.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
|
|
|
|
|
attribute.setBaseValue(attribute.getBaseValue() + (double)movementBoost);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void increaseKnockbackGain(EntityLivingBase gainingEntity) {
|
|
|
|
|
float kbResBoost = 0.1f;
|
|
|
|
|
IAttributeInstance attribute = gainingEntity.getEntityAttribute(SharedMonsterAttributes.knockbackResistance);
|
|
|
|
|
attribute.setBaseValue(attribute.getBaseValue() + (double)kbResBoost);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author
|
|
|
|
|
* @reason
|
|
|
|
|
*/
|
|
|
|
|
@Overwrite(remap = false)
|
|
|
|
|
public EntityPlayer getHiringPlayer() {
|
|
|
|
|
if (this.hiringPlayerUUID == null) {
|
|
|
|
|
|