2
0
Fork 0

Added stronger variant of Hill-troll Chieftain. Fixed Hill-troll Chieftain phases

main
Shinare 4 months ago
parent cc80be23dc
commit 54c2dbec62

@ -19,6 +19,7 @@ import com.zivilon.cinder_loe.entity.animals.Monkey;
import com.zivilon.cinder_loe.entity.boss.CryptBoss;
import com.zivilon.cinder_loe.entity.corrupt.*;
import com.zivilon.cinder_loe.entity.npc.*;
import com.zivilon.cinder_loe.entity.npc.boss.*;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfBannerBearer;
import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfCommander;
@ -407,7 +408,7 @@ public class CinderLoE {
// event.registerServerCommand(new CommandMobileSound());
}
public void registerEntities() { // Last ID added: 83
public void registerEntities() { // Last ID added: 84
///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock");
///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword");
@ -466,7 +467,7 @@ public class CinderLoE {
EntityRegistry.registerModEntity(Monkey.class, "Monkey", (entityID + 62), this, 64, 1, true);
EntityRegistry.registerModEntity(CryptBoss.class, "CryptBoss", (entityID + 66), this, 64, 1, true);
EntityRegistry.registerModEntity(EntityMorgulBlast.class, "EntityMorgulBlast", (entityID + 65), this, 64, 1, true);
EntityRegistry.registerModEntity(StrongHillTrollChieftain.class, "StrongHillTrollChieftain", (entityID + 84), this, 64, 1, true);
// Faction Units
@ -1230,6 +1231,7 @@ public class CinderLoE {
RenderingRegistry.registerEntityRenderingHandler(EsgarothSoldier.class, new LOTRRenderDaleMan());
RenderingRegistry.registerEntityRenderingHandler(MorgulOrc.class, new LOTRRenderOrc());
RenderingRegistry.registerEntityRenderingHandler(NorthernOrc.class, new LOTRRenderOrc());
RenderingRegistry.registerEntityRenderingHandler(StrongHillTrollChieftain.class, new LOTRRenderMountainTrollChieftain());
}
}

@ -0,0 +1,16 @@
package com.zivilon.cinder_loe.entity.npc.boss;
import lotr.common.entity.npc.LOTREntityMountainTrollChieftain;
import net.minecraft.world.World;
import net.minecraft.entity.SharedMonsterAttributes;
public class StrongHillTrollChieftain extends LOTREntityMountainTrollChieftain {
public StrongHillTrollChieftain(World world) {
super(world);
}
public void applyEntityAttributes() {
super.applyEntityAttributes();
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(150.0D);
}
}

@ -0,0 +1,48 @@
package com.zivilon.cinder_loe.mixins;
import lotr.common.LOTRMod;
import lotr.common.entity.npc.LOTREntityMountainTrollChieftain;
import lotr.common.entity.npc.LOTREntityMountainTroll;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.SharedMonsterAttributes;
import com.zivilon.cinder_loe.util.IBossEntity;
@Mixin(LOTREntityMountainTrollChieftain.class)
public class MixinLOTREntityMountainTrollChieftain extends LOTREntityMountainTroll implements IBossEntity {
@Shadow
public int getTrollArmorLevel() {return 1;}
@Shadow
public void setTrollArmorLevel(int i) {}
public MixinLOTREntityMountainTrollChieftain(World world) {
super(world);
}
@Overwrite
protected void damageEntity(DamageSource damagesource, float f) {
super.damageEntity(damagesource, f);
}
public void change_phase() {
if (!this.worldObj.isRemote) {
setTrollArmorLevel(getTrollArmorLevel() - 1);
if (getTrollArmorLevel() == 0) {
double speed = getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
speed *= 1.5D;
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(speed);
}
double maxHealth = getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue();
maxHealth *= 2.0D;
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxHealth);
setHealth(getMaxHealth());
this.worldObj.setEntityState((Entity)this, (byte)21);
}
}
}

@ -4,6 +4,8 @@ import net.minecraft.entity.*;
import net.minecraft.entity.player.*;
import net.minecraft.util.DamageSource;
import com.zivilon.cinder_loe.util.IBossEntity;
import com.zivilon.cinder_loe.mixins.MixinLOTREnchantment;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
@ -11,6 +13,7 @@ import lotr.common.enchant.LOTREnchantmentHelper;
import lotr.common.item.*;
import net.minecraft.item.*;
import net.minecraft.world.World;
import lotr.common.entity.npc.LOTREntityMountainTrollChieftain;
public class DamageEvent {
public DamageSource source;
@ -27,12 +30,20 @@ public class DamageEvent {
public static Pair<DamageEvent, Boolean> run_events(DamageEvent event) {
boolean cancel = false;
World world = event.defender.worldObj;
cancel = (cancel || attack_block_task(event));
cancel = (cancel || fire_armor_repair_task(event));
cancel = (cancel || fix_hill_troll_chieftain_task(event));
return new Pair<>(event, cancel);
}
public static boolean attack_block_task(DamageEvent event) {
boolean cancel = false;
World world = event.defender.worldObj;
if (event.defender instanceof EntityPlayer && !event.source.isUnblockable()) {
EntityPlayerMP player = (EntityPlayerMP) event.defender;
ItemStack sword = player.getHeldItem();
if (!(event.attacker instanceof EntityLivingBase)) return new Pair<>(event, cancel);
if (!(event.attacker instanceof EntityLivingBase)) return cancel;
EntityLivingBase attacker = (EntityLivingBase)event.attacker;
float playerYaw = player.getRotationYawHead();
@ -72,6 +83,10 @@ public class DamageEvent {
}
}
}
return cancel;
}
public static boolean fire_armor_repair_task(DamageEvent event) {
boolean cancel = false;
if (event.source.isFireDamage() && event.defender instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.defender;
for (ItemStack armor : player.inventory.armorInventory) {
@ -88,6 +103,22 @@ public class DamageEvent {
}
}
}
return new Pair<>(event, cancel);
return cancel;
}
public static boolean fix_hill_troll_chieftain_task(DamageEvent event) {
boolean cancel = false;
if (event.defender instanceof LOTREntityMountainTrollChieftain) {
LOTREntityMountainTrollChieftain defender = (LOTREntityMountainTrollChieftain)event.defender;
if (defender.getTrollArmorLevel() > 0)
if (defender.getHealth() - event.damage <= 0.0F) {
((IBossEntity)(Object)(defender)).change_phase();
cancel = true;
}
}
return cancel;
}
public static boolean template_task(DamageEvent event) {
boolean cancel = false;
return cancel;
}
}

@ -0,0 +1,5 @@
package com.zivilon.cinder_loe.util;
public interface IBossEntity {
public void change_phase();
}

@ -63,7 +63,8 @@
"MixinLOTRItemMug",
"MixinLOTREntityHorse",
"MixinLOTRGuiMap",
"MixinLOTREntityAIOrcSkirmish"
"MixinLOTREntityAIOrcSkirmish",
"MixinLOTREntityMountainTrollChieftain"
],
"client": []
}

Loading…
Cancel
Save