diff --git a/gradle.properties b/gradle.properties index 7ca3422..2e6e07c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ modName = CinderLoE -modVersion = 1.4.0 +modVersion = 1.4.1 modId = cinder_loe modGroup = com.zivilon.cinder_loe diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 4079fa5..4bc3d6d 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -573,10 +573,10 @@ public class CinderLoE { spiceHuman = new Item().setUnlocalizedName("lotr:spice_human").setTextureName("lotr:spice_human"); spiceOrcish = new Item().setUnlocalizedName("lotr:spice_orcish").setTextureName("lotr:spice_orcish"); spiceDwarven = new Item().setUnlocalizedName("lotr:spice_dwarven").setTextureName("lotr:spice_dwarven"); - mugElfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.moveSpeed.id, 180, 1).toxic().setUnlocalizedName("lotr:mugElfBrew"); - mugHumanBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.regeneration.id, 180, 1).toxic().setUnlocalizedName("lotr:mugHumanBrew"); - mugOrcBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.damageBoost.id, 180, 1).toxic().setUnlocalizedName("lotr:mugOrcBrew"); - mugDwarfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.field_76443_y.id, 360).toxic().setUnlocalizedName("lotr:mugDwarfBrew"); + mugElfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.moveSpeed.id, 60, 1).toxic().setUnlocalizedName("lotr:mugElfBrew"); + mugHumanBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.regeneration.id, 60, 1).toxic().setUnlocalizedName("lotr:mugHumanBrew"); + mugOrcBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.damageBoost.id, 60, 1).toxic().setUnlocalizedName("lotr:mugOrcBrew"); + mugDwarfBrew = (new LoEItemMug(0.0F)).setDrinkStats(20, 1.0F).addPotionEffect(Potion.field_76443_y.id, 120).toxic().setUnlocalizedName("lotr:mugDwarfBrew"); ((LoEItemMug)mugElfBrew).setTextureNameFromUnlocalizedName(); ((LoEItemMug)mugHumanBrew).setTextureNameFromUnlocalizedName(); ((LoEItemMug)mugOrcBrew).setTextureNameFromUnlocalizedName(); diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE_Config.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE_Config.java index d8639bf..10dde10 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE_Config.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE_Config.java @@ -25,6 +25,8 @@ public class CinderLoE_Config { public static boolean objective_dale; public static boolean objective_rhudaur; + public static boolean warbands_enabled; + public static void init(FMLPreInitializationEvent event) { File configFile = new File(event.getModConfigurationDirectory(), "CinderLoE.cfg"); @@ -55,6 +57,7 @@ public class CinderLoE_Config { objective_dale = config.getBoolean("Dale", Configuration.CATEGORY_GENERAL, false, "set true if Dalish Objective Complete"); objective_rhudaur = config.getBoolean("Rhudaur", Configuration.CATEGORY_GENERAL, false, "set true if Rhudaur Objective Complete"); + warbands_enabled = config.getBoolean("Warbands", Configuration.CATEGORY_GENERAL, true, "Set false to disable warbands"); // Save the configuration if it has changed if (config.hasChanged()) { config.save(); diff --git a/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java index 4e8bb1c..0fe77ba 100644 --- a/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java +++ b/src/main/java/com/zivilon/cinder_loe/ShapelessDurabilityRecipe.java @@ -28,7 +28,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { @Override public boolean matches(InventoryCrafting inv, World worldIn) { - System.out.println("[CinderLoE] Checking matches for ShapelessDurabilityRecipe"); boolean hasTool = false; List ingredientsCopy = new ArrayList<>(this.recipeItems); @@ -48,7 +47,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { } } if (!matched) { - System.out.println("[CinderLoE] Ingredient did not match: " + stack); return false; } } @@ -56,13 +54,11 @@ public class ShapelessDurabilityRecipe implements IRecipe { } boolean matches = hasTool && ingredientsCopy.isEmpty(); - System.out.println("[CinderLoE] ShapelessDurabilityRecipe match result: " + matches + ", has tool: " + hasTool); return matches; } @Override public ItemStack getCraftingResult(InventoryCrafting inv) { - System.out.println("[CinderLoE] Getting crafting result for ShapelessDurabilityRecipe"); return this.recipeOutput.copy(); } @@ -77,7 +73,6 @@ public class ShapelessDurabilityRecipe implements IRecipe { } public ItemStack[] getRemainingItems(InventoryCrafting inv) { - System.out.println("[CinderLoE] Getting remaining items for ShapelessDurabilityRecipe"); ItemStack[] remainingItems = new ItemStack[inv.getSizeInventory()]; for (int i = 0; i < remainingItems.length; ++i) { @@ -86,16 +81,13 @@ public class ShapelessDurabilityRecipe implements IRecipe { if (itemstack != null && itemstack.getItem() == toolItem) { ItemStack tool = itemstack.copy(); tool.setItemDamage(tool.getItemDamage() + 1); - System.out.println("[CinderLoE] Damaging tool: " + tool.getUnlocalizedName() + " | New Damage: " + tool.getItemDamage()); if (tool.getItemDamage() >= tool.getMaxDamage()) { - System.out.println("[CinderLoE] Tool is out of durability, breaking: " + tool.getUnlocalizedName()); tool = null; } remainingItems[i] = tool; } else if (itemstack != null && itemstack.getItem().hasContainerItem(itemstack)) { - System.out.println("[CinderLoE] Consuming non-tool item " + itemstack.getUnlocalizedName()); remainingItems[i] = itemstack.getItem().getContainerItem(itemstack); } else { remainingItems[i] = itemstack; diff --git a/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java b/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java index 2b4dc85..787ff35 100644 --- a/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java +++ b/src/main/java/com/zivilon/cinder_loe/command/CommandWarband.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.command; +import com.zivilon.cinder_loe.CinderLoE_Config; import com.zivilon.cinder_loe.world.event.Warband; import com.zivilon.cinder_loe.world.event.WarbandFaction; @@ -24,7 +25,7 @@ public class CommandWarband extends CommandBase { @Override public String getCommandUsage(ICommandSender sender) { - return "/warband [faction_name] [waypoint] [x] [z]"; + return "/warband [faction_name] [waypoint] [x] [z]"; } @Override @@ -52,6 +53,14 @@ public class CommandWarband extends CommandBase { case "summon": summon_warband(sender, args); return; + case "on": + CinderLoE_Config.warbands_enabled = true; + sender.addChatMessage(new ChatComponentText("Warbands have been enabled!")); + return; + case "off": + CinderLoE_Config.warbands_enabled = true; + sender.addChatMessage(new ChatComponentText("Warbands have been disabled!")); + return; } } @@ -80,6 +89,7 @@ public class CommandWarband extends CommandBase { waypoint = LOTRWaypoint.waypointForName(waypoint_name); if (waypoint == null) { sender.addChatMessage(new ChatComponentText("Invalid waypoint \"" + waypoint_name + "\"")); + return; } Warband.initialize_warband(faction, waypoint); return; @@ -117,19 +127,15 @@ public class CommandWarband extends CommandBase { } public static boolean validate_args(String[] args) { - System.out.println("Validating..."); if (args.length < 1) return false; String action = ""; - System.out.println("Checking arg \"" + args[0] + "\""); - if (args[0].equals("summon") || args[0].equals("reset") || args[0].equals("list")) { + if (args[0].equals("summon") || args[0].equals("reset") || args[0].equals("list") || args[0].equals("on") || args[0].equals("off")) { action = args[0]; } else { - System.out.println("Failed test 1"); return false; } if (action.equals("summon")) { if (args.length < 2) { - System.out.println("Failed test 2"); return false; } WarbandFaction faction = WarbandFaction.get_warband_by_name(args[1]); diff --git a/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java b/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java index c980bc3..e6d6350 100644 --- a/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java +++ b/src/main/java/com/zivilon/cinder_loe/droptables/DropTable.java @@ -116,8 +116,6 @@ public class DropTable { if (drop instanceof SingleItemDrop) { SingleItemDrop single = (SingleItemDrop)drop; Item drop_item = single.item; - if (CinderLoE.DEBUG && drop_item == null) System.out.println("[DropTable_serializer] Item is null"); - if (CinderLoE.DEBUG && drop_item != null) System.out.println("[DropTable_serializer] item " + single.item.getUnlocalizedName()); drop_tag.setBoolean("looting_affects_quantity", single.looting_affects_quantity); drop_tag.setInteger("id", ((FMLControlledNamespacedRegistry)Item.itemRegistry).getId(drop_item)); if (single.nbt != null) diff --git a/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java b/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java index 2f02a1d..e58ed9d 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/Renegade.java @@ -129,43 +129,33 @@ public class Renegade extends LOTREntityMan { }, /* * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDunlendingName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDorwinionName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getDalishName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getRhunicName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getUmbarName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getHarnennorName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getSouthronCoastName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getNomadName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getGulfHaradName(this.rand, this.familyInfo.isMale())), * } * () -> { - * System.out.println("[CinderCore] Executing GondorName"); * this.familyInfo.setName(LOTRNames.getMoredainName(this.rand, this.familyInfo.isMale())), * } */ diff --git a/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java b/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java index 5d39b8b..6900eb0 100644 --- a/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java +++ b/src/main/java/com/zivilon/cinder_loe/items/LoEItemMug.java @@ -96,8 +96,8 @@ public class LoEItemMug extends LOTRItemMug { public void increment_toxin(EntityPlayer player) { int effect_duration = 7200; // 360 seconds * 20 ticks int effect_potency = 0; // Default to level 1 effect - PotionEffect potion = player.getActivePotionEffect(LoEPotions.herbal_poisoning); + PotionEffect potion = player.getActivePotionEffect(LoEPotions.overdose); if (potion != null) effect_potency = potion.getAmplifier() + 1; - player.addPotionEffect(new PotionEffect(LoEPotions.herbal_poisoning.id, effect_duration, effect_potency)); + player.addPotionEffect(new PotionEffect(LoEPotions.overdose.id, effect_duration, effect_potency)); } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java index 9625c7e..8599d7e 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinEntityPlayer.java @@ -154,22 +154,6 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix public int get_last_pickpocket_attempt() { return this.last_pickpocket_attempt; } - /* Proper solution for later - @Redirect( - method = "func_71059_n", - at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;field_70143_R:F", remap = false) - ) - private float redirectFallDistanceForCrit(Entity instance) { - if (instance instanceof EntityPlayer) { - PotionEffect poison = ((EntityPlayer) instance).getActivePotionEffect(LoEPotions.herbal_poisoning); - if (poison != null && poison.getAmplifier() >= 1) { - System.out.println("Setting fall distance to 0.0F"); - return 0.0F; // no fall distance = no crit - } - } - System.out.println("Preserving fall distance."); - return instance.fallDistance; - }*/ @Overwrite public void attackTargetEntityWithCurrentItem(Entity p_71059_1_) @@ -205,7 +189,6 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix if (f > 0.0F || f1 > 0.0F) { boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null && p_71059_1_ instanceof EntityLivingBase; - System.out.println("Hello"); if (PotionHerbPoison.should_cancel_crit((EntityPlayer)(Object)this)) { flag = false; } @@ -305,9 +288,9 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix } @Inject(method = "onLivingUpdate", at = @At("TAIL")) - public void disableHotbarSlotsHerbalPoisoning(CallbackInfo ci) { + public void disableHotbarSlotsOverdose(CallbackInfo ci) { EntityPlayer player = (EntityPlayer)(Object)this; - PotionEffect effect = player.getActivePotionEffect(LoEPotions.herbal_poisoning); + PotionEffect effect = player.getActivePotionEffect(LoEPotions.overdose); if (effect != null && effect.getAmplifier() >= 2) { int slot = player.inventory.currentItem; @@ -318,12 +301,11 @@ public abstract class MixinEntityPlayer extends EntityLivingBase implements IMix } public boolean canAttackWithItem() { EntityPlayer player = (EntityPlayer)(Object)this; - PotionEffect effect = player.getActivePotionEffect(LoEPotions.herbal_poisoning); + PotionEffect effect = player.getActivePotionEffect(LoEPotions.overdose); if (effect != null && effect.getAmplifier() >= 2) { int slot = player.inventory.currentItem; if (slot >= 3 && slot <= 8) { - if (CinderLoE.DEBUG) System.out.println("ATTACK DENIED"); return false; } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinFoodStats.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinFoodStats.java index a616e15..424201f 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinFoodStats.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinFoodStats.java @@ -51,8 +51,7 @@ public class MixinFoodStats { ++this.foodTimer; if (this.foodTimer >= 80) { - boolean has_herbal_poisoning = false; - PotionEffect potion = player.getActivePotionEffect(LoEPotions.herbal_poisoning); + PotionEffect potion = player.getActivePotionEffect(LoEPotions.overdose); if (potion == null || potion.getAmplifier() < 1) player.heal(1.0F); this.addExhaustion(3.0F); diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIAttackOnCollide.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIAttackOnCollide.java index a4af150..c1fbe49 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIAttackOnCollide.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIAttackOnCollide.java @@ -4,6 +4,7 @@ import com.zivilon.cinder_loe.CinderLoE; import com.zivilon.cinder_loe.client.model.*; import com.zivilon.cinder_loe.entity.Renegade; import com.zivilon.cinder_loe.util.IEntityLivingBase; +import com.zivilon.cinder_loe.util.Utilities; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -27,35 +28,39 @@ import java.util.UUID; @Mixin(LOTREntityAIAttackOnCollide.class) public class MixinLOTREntityAIAttackOnCollide { - @Shadow + @Shadow(remap = false) protected World worldObj; - @Shadow + @Shadow(remap = false) protected EntityCreature theOwner; - @Shadow + @Shadow(remap = false) protected EntityLivingBase attackTarget; - @Shadow + @Shadow(remap = false) protected int attackTick; - @Shadow + @Shadow(remap = false) protected void updateLookAndPathing() {} public UUID leader_id; public Entity leader; @Overwrite public void updateTask() { + if (warband_task()) return; + update_vanilla_task(); + } + + private boolean warband_task() { EntityCreature entity = this.theOwner; UUID leader_id = ((IEntityLivingBase)entity).get_warband_uuid(); if (leader_id != null) { if (leader == null) - leader = find_entity_by_uuid(entity.worldObj, leader_id); + leader = Utilities.find_entity_by_uuid(entity.worldObj, leader_id); if (leader != null && entity.getDistanceSqToEntity(leader) > 576.0D) { entity.setAttackTarget(null); entity.getNavigator().tryMoveToEntityLiving(leader, 1.3D); - return; // Return here to not run default logic + return true; // Return here to not run default logic } } - - update_vanilla_task(); + return false; } private void update_vanilla_task() { @@ -95,13 +100,4 @@ public class MixinLOTREntityAIAttackOnCollide { this.theOwner.swingItem(); } } - - private Entity find_entity_by_uuid(World world, UUID uuid) { - for (Object obj : world.loadedEntityList) { - if (obj instanceof Entity && uuid.equals(((Entity) obj).getUniqueID())) { - return (Entity)obj; - } - } - return null; - } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java index a3e8f1f..7802fe5 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAINearestAttackableTargetBasic.java @@ -3,6 +3,7 @@ package com.zivilon.cinder_loe.mixins; import com.zivilon.cinder_loe.entity.Renegade; import com.zivilon.cinder_loe.potion.LoEPotions; import com.zivilon.cinder_loe.util.IEntityLivingBase; +import com.zivilon.cinder_loe.util.Utilities; import lotr.common.LOTRLevelData; import lotr.common.LOTRMod; @@ -10,6 +11,7 @@ import lotr.common.entity.ai.LOTREntityAINearestAttackableTargetBasic; import lotr.common.entity.ai.LOTREntityAINearestAttackableTargetBasic.TargetSorter; import lotr.common.entity.npc.LOTREntityNPC; import lotr.common.entity.npc.LOTREntityNPCRideable; +import lotr.common.item.LOTRItemArmor; import net.minecraft.command.IEntitySelector; import net.minecraft.entity.Entity; @@ -17,32 +19,32 @@ import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; -import org.spongepowered.asm.mixin.injection.callback.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.UUID; import java.util.Collections; import java.util.List; +import java.util.UUID; +import net.minecraft.util.ChatComponentText; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; @Mixin(LOTREntityAINearestAttackableTargetBasic.class) public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends EntityAITarget { - @Shadow - private final Class targetClass; - @Shadow - private EntityLivingBase targetEntity; - @Shadow - private final TargetSorter targetSorter; - @Shadow - private final IEntitySelector targetSelector; - @Shadow - private final int targetChance; + + @Shadow private final Class targetClass; + @Shadow private EntityLivingBase targetEntity; + @Shadow private final TargetSorter targetSorter; + @Shadow private final IEntitySelector targetSelector; + @Shadow private final int targetChance; public MixinLOTREntityAINearestAttackableTargetBasic(EntityCreature p_i1669_1_, boolean p_i1669_2_) { super(p_i1669_1_, p_i1669_2_); - targetClass = null; // Should never get applied because constructors can't be overwritten + targetClass = null; targetEntity = null; targetSorter = null; targetSelector = null; @@ -51,25 +53,29 @@ public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends Enti @Overwrite(remap = true) public boolean shouldExecute() { + if (warband_should_execute()) return false; + return original_should_execute(); + } + + private boolean warband_should_execute() { EntityCreature self = taskOwner; - if (!(self instanceof IEntityLivingBase)) return original_should_execute(); + if (!(self instanceof IEntityLivingBase)) return false; UUID leader_id = ((IEntityLivingBase) self).get_warband_uuid(); - if (leader_id == null) return original_should_execute(); + if (leader_id == null) return false; - Entity leader = find_entity_by_uuid(self.worldObj, leader_id); - if (leader == null) return original_should_execute(); + Entity leader = Utilities.find_entity_by_uuid(self.worldObj, leader_id); + if (leader == null) return false; double distance_squared = self.getDistanceSqToEntity(leader); if (distance_squared > 576.0D) { self.setAttackTarget(null); self.getNavigator().tryMoveToEntityLiving(leader, 1.3D); - return false; + return true; } - return original_should_execute(); + return false; } - public boolean original_should_execute() { if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) return false; @@ -96,24 +102,39 @@ public abstract class MixinLOTREntityAINearestAttackableTargetBasic extends Enti return true; } - private Entity find_entity_by_uuid(World world, UUID uuid) { - for (Object obj : world.loadedEntityList) { - if (obj instanceof Entity && uuid.equals(((Entity) obj).getUniqueID())) { - return (Entity)obj; - } - } - return null; - } - /** - * @author Shinare - * @reason Added corrupting potion effect that makes all NPCs hostile - */ + * @author Shinare + * @reason Added corrupting potion effect that makes all NPCs hostile + */ @Overwrite(remap = false) protected boolean isPlayerSuitableAlignmentTarget(EntityPlayer entityplayer) { float alignment = LOTRLevelData.getData(entityplayer).getAlignment(LOTRMod.getNPCFaction((Entity)this.taskOwner)); if (entityplayer == null || LoEPotions.corrupting == null) return alignment < 0.0F; - boolean corrupting = entityplayer.isPotionActive(LoEPotions.corrupting); // Needs to be implemented + boolean corrupting = entityplayer.isPotionActive(LoEPotions.corrupting); return (alignment < 0.0F || corrupting); } + + @Inject(method = "isPlayerSuitableTarget", at = @At("HEAD"), cancellable = true, remap = false) + private void cinderloe$applyStealthModifier(EntityPlayer player, CallbackInfoReturnable cir) { + int stealthPieces = 0; + + for (ItemStack armor : player.inventory.armorInventory) { + if (armor != null && armor.getItem() instanceof LOTRItemArmor && armor.stackTagCompound != null) { + if (LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("stealth"))) { + stealthPieces++; + } + } + } + + if (stealthPieces > 0 && taskOwner != null) { + double baseDetectionRange = taskOwner.getEntityAttribute(net.minecraft.entity.SharedMonsterAttributes.followRange).getAttributeValue(); + double multiplier = 1.0 - (0.15 * stealthPieces); + double effectiveRangeSq = (baseDetectionRange * multiplier) * (baseDetectionRange * multiplier); + double distanceSq = taskOwner.getDistanceSqToEntity(player); + + if (distanceSq > effectiveRangeSq) { + cir.setReturnValue(false); + } + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIRangedAttack.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIRangedAttack.java new file mode 100644 index 0000000..dad0ebb --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityAIRangedAttack.java @@ -0,0 +1,119 @@ +package com.zivilon.cinder_loe.mixins; + +import com.zivilon.cinder_loe.CinderLoE; +import com.zivilon.cinder_loe.client.model.*; +import com.zivilon.cinder_loe.entity.Renegade; +import com.zivilon.cinder_loe.util.IEntityLivingBase; +import com.zivilon.cinder_loe.util.Utilities; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Overwrite; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.entity.ai.LOTREntityAIRangedAttack; +import lotr.common.item.LOTRItemSpear; +import lotr.common.item.LOTRWeaponStats; + +import java.util.UUID; + +@Mixin(LOTREntityAIRangedAttack.class) +public class MixinLOTREntityAIRangedAttack { + + @Shadow(remap = false) + private EntityLiving theOwner; + @Shadow(remap = false) + private IRangedAttackMob theOwnerRanged; + @Shadow(remap = false) + private EntityLivingBase attackTarget; + @Shadow(remap = false) + private int rangedAttackTime; + @Shadow(remap = false) + private double moveSpeed; + @Shadow(remap = false) + private double moveSpeedFlee = 1.5D; + @Shadow(remap = false) + private int repathDelay; + @Shadow(remap = false) + private int attackTimeMin; + @Shadow(remap = false) + private int attackTimeMax; + @Shadow(remap = false) + private float attackRange; + @Shadow(remap = false) + private float attackRangeSq; + @Shadow(remap = false) + public static Vec3 findPositionAwayFrom(EntityLivingBase entity, EntityLivingBase target, int min, int max) {return null;} + + public UUID leader_id; + public Entity leader; + + @Overwrite + public void updateTask() { + if (warband_task()) return; + update_vanilla_task(); + } + + private boolean warband_task() { + EntityLiving entity = this.theOwner; + UUID leader_id = ((IEntityLivingBase)entity).get_warband_uuid(); + + if (leader_id != null) { + if (leader == null) + leader = Utilities.find_entity_by_uuid(entity.worldObj, leader_id); + if (leader != null && entity.getDistanceSqToEntity(leader) > 576.0D) { + entity.setAttackTarget(null); + entity.getNavigator().tryMoveToEntityLiving(leader, 1.3D); + return true; // Return here to not run default logic + } + } + return false; + } + + private void update_vanilla_task() { + double distanceSq = this.theOwner.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); + boolean canSee = this.theOwner.getEntitySenses().canSee((Entity)this.attackTarget); + if (canSee) { + this.repathDelay++; + } else { + this.repathDelay = 0; + } + if (distanceSq <= this.attackRangeSq) { + if (this.theOwner.getDistanceSqToEntity((Entity)this.attackTarget) < 25.0D) { + Vec3 vec = findPositionAwayFrom((EntityLivingBase)this.theOwner, this.attackTarget, 8, 16); + if (vec != null) + this.theOwner.getNavigator().tryMoveToXYZ(vec.xCoord, vec.yCoord, vec.zCoord, this.moveSpeedFlee); + } else if (this.repathDelay >= 20) { + this.theOwner.getNavigator().clearPathEntity(); + this.repathDelay = 0; + } + } else { + this.theOwner.getNavigator().tryMoveToEntityLiving((Entity)this.attackTarget, this.moveSpeed); + } + this.theOwner.getLookHelper().setLookPositionWithEntity((Entity)this.attackTarget, 30.0F, 30.0F); + this.rangedAttackTime--; + if (this.rangedAttackTime == 0) { + if (distanceSq > this.attackRangeSq || !canSee) + return; + float distanceRatio = MathHelper.sqrt_double(distanceSq) / this.attackRange; + float power = distanceRatio; + power = MathHelper.clamp_float(power, 0.1F, 1.0F); + this.theOwnerRanged.attackEntityWithRangedAttack(this.attackTarget, power); + this.rangedAttackTime = MathHelper.floor_float(distanceRatio * (this.attackTimeMax - this.attackTimeMin) + this.attackTimeMin); + } else if (this.rangedAttackTime < 0) { + float distanceRatio = MathHelper.sqrt_double(distanceSq) / this.attackRange; + this.rangedAttackTime = MathHelper.floor_float(distanceRatio * (this.attackTimeMax - this.attackTimeMin) + this.attackTimeMin); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityHorse.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityHorse.java new file mode 100644 index 0000000..7f5d7da --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityHorse.java @@ -0,0 +1,38 @@ +package com.zivilon.cinder_loe.mixins; + +import lotr.common.entity.animal.LOTREntityHorse; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import lotr.common.item.LOTRItemArmor; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(LOTREntityHorse.class) +public class MixinLOTREntityHorse { + + @Inject(method = "func_70658_aO", at = @At("RETURN"), cancellable = true, remap = false) + private void cinderloe$boostArmorFromRider(CallbackInfoReturnable cir) { + LOTREntityHorse horse = (LOTREntityHorse)(Object)this; + + if (horse.riddenByEntity instanceof EntityPlayer) { + EntityPlayer rider = (EntityPlayer) horse.riddenByEntity; + + int bonus = 0; + for (ItemStack armor : rider.inventory.armorInventory) { + if (armor != null && LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("mountArmor"))) { + bonus++; + } + } + + if (bonus > 0) { + int newArmorValue = cir.getReturnValue() + bonus; + cir.setReturnValue(newArmorValue); + } + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java index 47171fe..6008768 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java @@ -50,21 +50,16 @@ public abstract class MixinLOTREntityNPC extends EntityCreature implements ILoot if (success) { List drops = DropTable.generate_drops((LOTREntityNPC)(Object)this, new DropContext[]{DropContext.PICKPOCKET}, 0); ItemStack item = drops.get(DropTable.random.nextInt(drops.size())); - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Giving pickpocket reward " + item.getItem().getUnlocalizedName()); if (entityplayer.inventory.addItemStackToInventory(item)) { - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Item successfully granted"); last_pickpocket = (int)(System.currentTimeMillis() / 1000L); } else { - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Item grant failed"); } } else { last_pickpocket = (int)(System.currentTimeMillis() / 1000L); ((LOTREntityNPC)(Object)this).setRevengeTarget(entityplayer); - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Pickpocket failed."); } return true; } - if (CinderLoE.DEBUG) System.out.println("[MixinLOTREntityNPC] Pickpocket didn't happen."); if (!this.worldObj.isRemote && canNPCTalk()) { if (this.questInfo.interact(entityplayer)) return true; diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityWarg.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityWarg.java index 895c0d1..f5e23cb 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityWarg.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityWarg.java @@ -9,7 +9,16 @@ 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.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.Shadow; +import lotr.common.entity.animal.LOTREntityHorse; +import lotr.common.enchant.LOTREnchantment; +import lotr.common.enchant.LOTREnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import lotr.common.item.LOTRItemArmor; @Mixin(LOTREntityWarg.class) @@ -73,5 +82,22 @@ public abstract class MixinLOTREntityWarg extends Entity { entityDropItem(new ItemStack(LOTRMod.wargskinRug, 1, (getWargType()).wargID), 0.0F); } } + @Inject(method = "func_70658_aO", at = @At("RETURN"), cancellable = true, remap = false) + private void cinderloe$boostArmorFromRider(CallbackInfoReturnable cir) { + if (this.riddenByEntity instanceof EntityPlayer) { + EntityPlayer rider = (EntityPlayer) this.riddenByEntity; + + int bonus = 0; + for (ItemStack armor : rider.inventory.armorInventory) { + if (armor != null && LOTREnchantmentHelper.hasEnchant(armor, LOTREnchantment.getEnchantmentByName("mountArmor"))) { + bonus++; + } + } + if (bonus > 0) { + int newArmorValue = cir.getReturnValue() + bonus; + cir.setReturnValue(newArmorValue); + } + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java index 3a89dea..29c8e42 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTRGuiMap.java @@ -46,26 +46,19 @@ public abstract class MixinLOTRGuiMap extends LOTRGuiMenuBase { @Shadow(remap = false) public float[] transformCoords(float x, float z) { return null;} - @Inject(method = "func_73863_a", at = @At("HEAD"), remap = false) - public void inject_head(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - System.out.println("[MixinLOTRGuiMap] Inject at HEAD"); - } @Inject(method = "func_73863_a", at = @At( value = "INVOKE", target = "renderPlayers(II)V", shift = At.Shift.AFTER), remap = false) public void inject_render_warbands(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - System.out.println("[MixinLOTRGuiMap] Running wrapper"); render_warbands(mouseX, mouseY); } @Dynamic private void render_warbands(int cursor_x, int cursor_y) { - System.out.println("[MixinLOTRGuiMap] Rendering warband icon"); String mouse_over_warband_name = null; double mouse_over_warband_x = 0.0D; double mouse_over_warband_y = 0.0D; double shortest_distance_to_cursor = Double.MAX_VALUE; int icon_width_half = 4; for (Map.Entry entry : warband_locations.entrySet()) { - System.out.println("[MixinLOTRGuiMap] Iterated"); WarbandLocationInfo info = entry.getValue(); Warband warband = info.warband; String warband_name = warband.faction.warband_name; @@ -129,7 +122,6 @@ public abstract class MixinLOTRGuiMap extends LOTRGuiMenuBase { @Dynamic private void load_warband_icon(boolean ally, int x, int y) { - System.out.println("[MixinLOTRGuiMap] Loading warband icon: " + (ally ? "ally" : "enemy")); mc.getTextureManager().bindTexture(LOTRClientProxy.alignmentTexture); GL11.glColor4f(1F, 1F, 1F, 1F); int variant = ally ? 16 : 0; diff --git a/src/main/java/com/zivilon/cinder_loe/potion/LoEPotions.java b/src/main/java/com/zivilon/cinder_loe/potion/LoEPotions.java index e9a0678..c68e9ac 100644 --- a/src/main/java/com/zivilon/cinder_loe/potion/LoEPotions.java +++ b/src/main/java/com/zivilon/cinder_loe/potion/LoEPotions.java @@ -6,11 +6,11 @@ import net.minecraft.entity.EntityLivingBase; public class LoEPotions { public static Potion corrupting; - public static Potion herbal_poisoning; + public static Potion overdose; public static void registerPotions() { corrupting = new PotionCorrupting(31, false, 0x7F0000).setPotionName("potion.corrupting"); - herbal_poisoning = new PotionHerbPoison(29, false, 0x114023).setPotionName("potion.herbal_poisoning"); + overdose = new PotionHerbPoison(29, false, 0x114023).setPotionName("potion.overdose"); } } diff --git a/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java b/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java index 6b0dd5f..cb5defd 100644 --- a/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java +++ b/src/main/java/com/zivilon/cinder_loe/potion/PotionHerbPoison.java @@ -2,12 +2,21 @@ package com.zivilon.cinder_loe.potion; import com.zivilon.cinder_loe.CinderLoE; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class PotionHerbPoison extends Potion { + public static ResourceLocation OVERDOSE_ICON = new ResourceLocation("cinder_loe", "misc/overdose.png"); + public PotionHerbPoison(int id, boolean isBadEffect, int liquidColor) { super(id, isBadEffect, liquidColor); } @@ -22,12 +31,19 @@ public class PotionHerbPoison extends Potion { } public static boolean should_cancel_crit(EntityPlayer player) { - PotionEffect poison = player.getActivePotionEffect(LoEPotions.herbal_poisoning); + PotionEffect poison = player.getActivePotionEffect(LoEPotions.overdose); if (poison != null && poison.getAmplifier() >= 1) { - if (CinderLoE.DEBUG) System.out.println("Should cancel crit"); return true; } - if (CinderLoE.DEBUG) System.out.println("Should not cancel crit"); + return false; + } + @Override + public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { + // Currently not implemented + } + + @Override + public boolean hasStatusIcon() { return false; } } diff --git a/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java b/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java index 4f1d224..1587552 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java +++ b/src/main/java/com/zivilon/cinder_loe/util/PickpocketUtils.java @@ -31,7 +31,6 @@ public class PickpocketUtils { public static Random random = new Random(); public static boolean can_pickpocket(EntityPlayer player, LOTREntityNPC target) { - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Checking if can pickpocket..."); if (!player.isSneaking()) return false; DropTable table = ((ILootableEntity)(Object)target).get_drop_table(); @@ -49,7 +48,7 @@ public class PickpocketUtils { return false; } - if (((IMixinEntityPlayer)player).get_last_pickpocket_attempt() > (int)(System.currentTimeMillis() / 1000L - 4)) { + if (((IMixinEntityPlayer)player).get_last_pickpocket_attempt() > (int)(System.currentTimeMillis() / 1000L - 1) || ((ILootableEntity)(Object)target).get_last_pickpocket() > (int)(System.currentTimeMillis() / 1000L - 4)) { if (random.nextInt(10000) == 1) { player.addChatMessage(new ChatComponentTranslation("pickpocket.cooldown_alt")); } else { @@ -58,11 +57,9 @@ public class PickpocketUtils { return false; } - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Yes can pickpocket"); return true; } public static boolean pickpocket(EntityPlayer player, LOTREntityNPC target) { - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Pickpocketing..."); ILootableEntity npc = (ILootableEntity)(Object)target; float penalty = 1.0F; if (!is_behind(player, (EntityLivingBase)target)) penalty -= 0.4F; @@ -70,7 +67,6 @@ public class PickpocketUtils { if (is_invisible(player)) penalty += 0.4F; if (is_cloaked(player)) penalty += 0.2F; boolean success = random.nextFloat() < npc.get_pickpocket_chance() * penalty; - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Pickpocketing " + success); return success; } @@ -79,7 +75,6 @@ public class PickpocketUtils { float playerYaw = player.rotationYaw % 360; float angleDiff = MathHelper.wrapAngleTo180_float(npcYaw - playerYaw); boolean is_behind = Math.abs(angleDiff) < 30F; - if (CinderLoE.DEBUG) System.out.println("[PickpocketUtils] Is behind? " + is_behind); return is_behind; } @@ -120,7 +115,7 @@ public class PickpocketUtils { DropTable table = new DropTable(); DropContext[] default_context = new DropContext[] {DropContext.PICKPOCKET}; - table.drop_list.add(new SingleItemDrop(LOTRMod.silverCoin, null, 1.0F, 8, 16, false, false, default_context)); + table.drop_list.add(new SingleItemDrop(LOTRMod.silverCoin, null, 1.0F, 8, 32, false, false, default_context)); if (entity instanceof LOTREntityMan) { table.drop_list.add(new SingleItemDrop(Items.cooked_chicken, null, 0.2F, 1, 3, false, false, default_context)); table.drop_list.add(new SingleItemDrop(Items.book, null, 0.2F, 1, 3, false, false, default_context)); diff --git a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java index 8f9f5fe..d6602e8 100644 --- a/src/main/java/com/zivilon/cinder_loe/util/Utilities.java +++ b/src/main/java/com/zivilon/cinder_loe/util/Utilities.java @@ -47,6 +47,7 @@ import net.minecraft.nbt.NBTTagString; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; public class Utilities { @@ -190,7 +191,6 @@ public class Utilities { EntityPlayer player = getPlayerByName(player_name); if (player == null) { - System.out.println("[CinderLoE] Warning! Player not found: " + player_name); return false; } @@ -329,4 +329,13 @@ public class Utilities { } return true; } + public static Entity find_entity_by_uuid(World world, UUID uuid) { + List snapshot = new ArrayList<>(world.loadedEntityList); // Safe copy + for (Entity entity : snapshot) { + if (uuid.equals(entity.getUniqueID())) { + return entity; + } + } + return null; + } } diff --git a/src/main/java/com/zivilon/cinder_loe/world/event/Warband.java b/src/main/java/com/zivilon/cinder_loe/world/event/Warband.java index 07687a8..99e4f2e 100644 --- a/src/main/java/com/zivilon/cinder_loe/world/event/Warband.java +++ b/src/main/java/com/zivilon/cinder_loe/world/event/Warband.java @@ -24,8 +24,11 @@ import lotr.common.LOTRDimension; import lotr.common.LOTRMod; import lotr.common.entity.npc.LOTRSpeech; import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.fac.LOTRFaction; import lotr.common.world.biome.LOTRBiome; import lotr.common.world.map.LOTRWaypoint; +import lotr.common.world.map.LOTRConquestGrid; +import lotr.common.world.map.LOTRConquestZone; import java.util.ArrayList; import java.util.List; @@ -34,7 +37,7 @@ import java.util.UUID; public class Warband { public static Random random = new Random(); - public static World world;; + public static World world; public static long last_warband_timestamp = System.currentTimeMillis() / 1000L - (60*60*2); // Initialize at 2 hour cooldown on server startup static { @@ -147,6 +150,7 @@ public class Warband { } }).start(); broadcast_warband(world, warband.faction.warband_name, warband.direction, warband.waypoint_name); + do_radial_conquest(world, warband.x, warband.z, warband.faction.faction, 50); last_warband_timestamp = System.currentTimeMillis() / 1000L; } public static void spawn_boss_entity(Warband warband, int x, int y, int z) { @@ -241,4 +245,33 @@ public class Warband { LOTRSpeech.messageAllPlayersInWorld(world, message); } + + public static void do_radial_conquest(World world, int posX, int posZ, LOTRFaction faction, float amount) { + if (!LOTRConquestGrid.conquestEnabled(world)) { + return; + } + + LOTRConquestZone zone = LOTRConquestGrid.getZoneByWorldCoords(posX, posZ); + if (zone == null || zone.isDummyZone) { + return; + } + + float current_strength = zone.getConquestStrength(faction, world); + float target_strength = current_strength + amount; + if (target_strength > 100000.0F) { + amount = 100000.0F - current_strength; + } else if (target_strength < 0.0F) { + amount = -current_strength; + } + + if (amount == 0.0F) { + return; + } + + if (amount < 0.0F) { + LOTRConquestGrid.doRadialConquest(world, zone, null, null, faction, -amount, -amount); + } else { + LOTRConquestGrid.doRadialConquest(world, zone, null, faction, null, amount, amount); + } + } } diff --git a/src/main/java/com/zivilon/cinder_loe/world/event/WarbandFaction.java b/src/main/java/com/zivilon/cinder_loe/world/event/WarbandFaction.java index 2964835..ec1fb59 100644 --- a/src/main/java/com/zivilon/cinder_loe/world/event/WarbandFaction.java +++ b/src/main/java/com/zivilon/cinder_loe/world/event/WarbandFaction.java @@ -7,6 +7,7 @@ import com.zivilon.cinder_loe.entity.npc.dwarf.*; import com.zivilon.cinder_loe.entity.npc.evil_human.*; import com.zivilon.cinder_loe.entity.npc.good_human.*; import com.zivilon.cinder_loe.entity.npc.orc.*; +import com.zivilon.cinder_loe.entity.npc.elf.*; import com.zivilon.cinder_loe.util.Utilities; import net.minecraft.entity.*; @@ -80,42 +81,42 @@ public enum WarbandFaction { */ static { MORDOR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityOlogHai.class, 5), new Troop(LOTREntityMordorOrc.class, 80), new Troop(LOTREntityMordorWarg.class, 30), new Troop(LOTREntityMordorOrcArcher.class, 25))); - BLACK_URUK.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBlackUruk.class, 50), new Troop(LOTREntityBlackUrukArcher.class, 30), new Troop(LOTREntityBlackUrukBannerBearer.class, 10))); - MORGUL_VALE.troops = new ArrayList<>(Arrays.asList(new Troop(MorgulOrc.class, 60), new Troop(LOTREntityMinasMorgulBannerBearer.class, 10), new Troop(LOTREntityMordorOrcArcher.class, 30))); - GONDOR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGondorSoldier.class, 60), new Troop(LOTREntityGondorTowerGuard.class, 15), new Troop(LOTREntityGondorBannerBearer.class, 10), new Troop(LOTREntityGondorArcher.class, 30))); - PELARGIR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityPelargirMarine.class, 80), new Troop(LOTREntityPelargirBannerBearer.class, 15))); - DOL_AMROTH.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDolAmrothSoldier.class, 50), new Troop(LOTREntityDolAmrothArcher.class, 30), new Troop(LOTREntityDolAmrothBannerBearer.class, 10), new Troop(LOTREntitySwanKnight.class, 10))); - ROHAN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityRohirrimWarrior.class, 60), new Troop(LOTREntityRohirrimArcher.class, 30))); - RIVENDELL.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityRivendellWarrior.class, 60), new Troop(LOTREntityRivendellBannerBearer.class, 15))); - LINDON.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityHighElfWarrior.class, 70), new Troop(LOTREntityHighElfBannerBearer.class, 20))); - BREE.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBreeGuard.class, 60), new Troop(BreeCrossbowman.class, 30), new Troop(BreeOutrider.class, 10), new Troop(LOTREntityBreeBannerBearer.class, 10))); - ARNOR.troops = new ArrayList<>(Arrays.asList(new Troop(ArnorSoldier.class, 50), new Troop(BattleNun.class, 10), new Troop(ArnorSoldierArcher.class, 30), new Troop(ArnorBannerBearer.class, 15))); - GUNDABAD.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGundabadOrc.class, 60), new Troop(LOTREntityGundabadWarg.class, 30), new Troop(LOTREntityGundabadUruk.class, 20), new Troop(LOTREntityGundabadOrcArcher.class, 30))); + BLACK_URUK.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBlackUruk.class, 70), new Troop(LOTREntityBlackUrukArcher.class, 30), new Troop(LOTREntityBlackUrukBannerBearer.class, 20))); + MORGUL_VALE.troops = new ArrayList<>(Arrays.asList(new Troop(MorgulOrc.class, 80), new Troop(LOTREntityMinasMorgulBannerBearer.class, 20), new Troop(LOTREntityMordorOrcArcher.class, 30))); + GONDOR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGondorSoldier.class, 60), new Troop(LOTREntityGondorTowerGuard.class, 15), new Troop(LOTREntityGondorBannerBearer.class, 20), new Troop(LOTREntityGondorArcher.class, 30))); + PELARGIR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityPelargirMarine.class, 100), new Troop(LOTREntityPelargirBannerBearer.class, 20))); + DOL_AMROTH.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDolAmrothSoldier.class, 60), new Troop(LOTREntityDolAmrothArcher.class, 30), new Troop(LOTREntityDolAmrothBannerBearer.class, 20), new Troop(LOTREntitySwanKnight.class, 15))); + ROHAN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityRohirrimWarrior.class, 120), new Troop(LOTREntityRohirrimArcher.class, 30))); + RIVENDELL.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityRivendellWarrior.class, 100), new Troop(LOTREntityRivendellBannerBearer.class, 20))); + LINDON.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityHighElfWarrior.class, 70), new Troop(Sirrandrai.class, 30), new Troop(LOTREntityHighElfBannerBearer.class, 20))); + BREE.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBreeGuard.class, 60), new Troop(BreeCrossbowman.class, 30), new Troop(BreeOutrider.class, 10), new Troop(LOTREntityBreeBannerBearer.class, 20))); + ARNOR.troops = new ArrayList<>(Arrays.asList(new Troop(ArnorSoldier.class, 50), new Troop(BattleNun.class, 10), new Troop(ArnorSoldierArcher.class, 30), new Troop(ArnorBannerBearer.class, 20))); + GUNDABAD.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGundabadOrc.class, 90), new Troop(LOTREntityGundabadWarg.class, 40), new Troop(LOTREntityGundabadUruk.class, 20), new Troop(LOTREntityGundabadOrcArcher.class, 40))); ANGMAR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityAngmarOrc.class, 60), new Troop(LOTREntityAngmarWarg.class, 30), new Troop(LOTREntityTroll.class, 8), new Troop(LOTREntityMountainTroll.class, 8), new Troop(LOTREntityAngmarBannerBearer.class, 10))); - RHUDAUR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityAngmarHillmanWarrior.class, 80), new Troop(LOTREntityAngmarHillmanAxeThrower.class, 40))); - WOOD_ELF.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityWoodElfWarrior.class, 60), new Troop(LOTREntityWoodElfBannerBearer.class, 15))); - WOOD_ELF_SCOUT.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityWoodElfScout.class, 90))); - DOL_GULDUR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDolGuldurOrc.class, 40), new Troop(LOTREntityDolGuldurOrcArcher.class, 15), new Troop(LOTREntityMirkTroll.class, 5), new Troop(LOTREntityMirkwoodSpider.class, 40))); - DALE.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDaleSoldier.class, 30), new Troop(LOTREntityDaleArcher.class, 50), new Troop(LOTREntityDaleLevyman.class, 30), new Troop(LOTREntityDaleBannerBearer.class, 10))); - DURINS_FOLK.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDwarfWarrior.class, 40), new Troop(LOTREntityDwarfAxeThrower.class, 30), new Troop(LOTREntityDwarfBannerBearer.class, 10))); - BLUE_MOUNTAINS.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBlueDwarfWarrior.class, 40), new Troop(LOTREntityBlueDwarfAxeThrower.class, 30), new Troop(LOTREntityBlueDwarfBannerBearer.class, 10))); - RED_MOUNTAINS.troops = new ArrayList<>(Arrays.asList(new Troop(RedDwarfWarrior.class, 40), new Troop(RedDwarfArbalest.class, 30), new Troop(RedDwarfBannerBearer.class, 10))); + RHUDAUR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityAngmarHillmanWarrior.class, 120), new Troop(LOTREntityAngmarHillmanAxeThrower.class, 40))); + WOOD_ELF.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityWoodElfWarrior.class, 100), new Troop(LOTREntityWoodElfBannerBearer.class, 20))); + WOOD_ELF_SCOUT.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityWoodElfScout.class, 120))); + DOL_GULDUR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDolGuldurOrc.class, 70), new Troop(LOTREntityDolGuldurOrcArcher.class, 15), new Troop(LOTREntityMirkTroll.class, 5), new Troop(LOTREntityMirkwoodSpider.class, 40))); + DALE.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDaleSoldier.class, 30), new Troop(LOTREntityDaleArcher.class, 50), new Troop(LOTREntityDaleLevyman.class, 60), new Troop(LOTREntityDaleBannerBearer.class, 20))); + DURINS_FOLK.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDwarfWarrior.class, 60), new Troop(LOTREntityDwarfAxeThrower.class, 40), new Troop(LOTREntityDwarfBannerBearer.class, 20))); + BLUE_MOUNTAINS.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityBlueDwarfWarrior.class, 70), new Troop(LOTREntityBlueDwarfAxeThrower.class, 30), new Troop(LOTREntityBlueDwarfBannerBearer.class, 20))); + RED_MOUNTAINS.troops = new ArrayList<>(Arrays.asList(new Troop(RedDwarfWarrior.class, 50), new Troop(RedDwarfArbalest.class, 50), new Troop(RedDwarfBannerBearer.class, 20))); DUNLAND.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDunlendingWarrior.class, 60), new Troop(LOTREntityDunlendingAxeThrower.class, 30), new Troop(LOTREntityDunlendingBerserker.class, 20))); - ISENGARD.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUrukHai.class, 50), new Troop(LOTREntityUrukHaiCrossbower.class, 20), new Troop(LOTREntityUrukHaiBerserker.class, 20))); + ISENGARD.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUrukHai.class, 60), new Troop(LOTREntityUrukHaiCrossbower.class, 20), new Troop(LOTREntityUrukHaiBerserker.class, 20), new Troop(LOTREntityUrukHaiBannerBearer.class, 20))); ISENGARD_SNAGA.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityIsengardSnaga.class, 60), new Troop(LOTREntityIsengardSnagaArcher.class, 40), new Troop(LOTREntityUrukWarg.class, 30))); FANGORN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityEnt.class, 30), new Troop(LOTREntityHuorn.class, 40))); - DORWINION.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDorwinionGuard.class, 40), new Troop(LOTREntityDorwinionCrossbower.class, 30), new Troop(LOTREntityDorwinionElfWarrior.class, 10), new Troop(LOTREntityDorwinionElfArcher.class, 10), new Troop(LOTREntityDorwinionBannerBearer.class, 10))); - RHUDEL.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityEasterlingWarrior.class, 60), new Troop(LOTREntityEasterlingArcher.class, 30), new Troop(LOTREntityEasterlingBannerBearer.class, 15))); - RHUDEL_GOLDEN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityEasterlingGoldWarrior.class, 100))); - UMBAR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUmbarWarrior.class, 40), new Troop(LOTREntityCorsair.class, 30), new Troop(LOTREntityUmbarArcher.class, 30), new Troop(LOTREntityUmbarBannerBearer.class, 15))); - HARNENNOR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityHarnedorWarrior.class, 60), new Troop(LOTREntityHarnedorArcher.class, 30), new Troop(LOTREntityHarnedorBannerBearer.class, 15))); - GULFEN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGulfHaradWarrior.class, 60), new Troop(LOTREntityGulfHaradArcher.class, 30), new Troop(LOTREntityGulfHaradBannerBearer.class, 15))); - MORWAITH.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityMoredainWarrior.class, 90), new Troop(LOTREntityMoredainBannerBearer.class, 15))); - LIMWAITH.troops = new ArrayList<>(Arrays.asList(new Troop(LimwaithWarrior.class, 50), new Troop(LimwaithBoneWarrior.class, 20), new Troop(LimwaithBlowgunner.class, 30), new Troop(LimwaithBannerBearer.class, 15))); - TAURETHRIM.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityTauredainWarrior.class, 60), new Troop(LOTREntityTauredainBlowgunner.class, 30), new Troop(TauredainTrueBlood.class, 15))); + DORWINION.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityDorwinionGuard.class, 40), new Troop(LOTREntityDorwinionCrossbower.class, 30), new Troop(LOTREntityDorwinionElfWarrior.class, 10), new Troop(LOTREntityDorwinionElfArcher.class, 10), new Troop(LOTREntityDorwinionBannerBearer.class, 20))); + RHUDEL.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityEasterlingWarrior.class, 60), new Troop(LOTREntityEasterlingArcher.class, 30), new Troop(LOTREntityEasterlingBannerBearer.class, 20))); + RHUDEL_GOLDEN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityEasterlingGoldWarrior.class, 120), new Troop(LOTREntityEasterlingBannerBearer.class, 20))); + UMBAR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUmbarWarrior.class, 70), new Troop(LOTREntityCorsair.class, 30), new Troop(LOTREntityUmbarArcher.class, 30), new Troop(LOTREntityUmbarBannerBearer.class, 20))); + HARNENNOR.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityHarnedorWarrior.class, 70), new Troop(LOTREntityHarnedorArcher.class, 30), new Troop(LOTREntityHarnedorBannerBearer.class, 20))); + GULFEN.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityGulfHaradWarrior.class, 70), new Troop(LOTREntityGulfHaradArcher.class, 30), new Troop(LOTREntityGulfHaradBannerBearer.class, 20))); + MORWAITH.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityMoredainWarrior.class, 100), new Troop(LOTREntityMoredainBannerBearer.class, 20))); + LIMWAITH.troops = new ArrayList<>(Arrays.asList(new Troop(LimwaithWarrior.class, 60), new Troop(LimwaithBoneWarrior.class, 20), new Troop(LimwaithBlowgunner.class, 30), new Troop(LimwaithBannerBearer.class, 15))); + TAURETHRIM.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityTauredainWarrior.class, 60), new Troop(LOTREntityTauredainBlowgunner.class, 50), new Troop(TauredainTrueBlood.class, 25))); HALF_TROLL.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityHalfTrollWarrior.class, 80), new Troop(LOTREntityHalfTrollBannerBearer.class, 20))); - UTUMNO.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUtumnoOrc.class, 60), new Troop(LOTREntityUtumnoOrcArcher.class, 40), new Troop(LOTREntityUtumnoSnowTroll.class, 15), new Troop(LOTREntityUtumnoFireWarg.class, 10), new Troop(LOTREntityUtumnoIceWarg.class, 10), new Troop(LOTREntityUtumnoObsidianWarg.class, 10), new Troop(LOTREntityUtumnoTroll.class, 10))); - RENEGADE.troops = new ArrayList<>(Arrays.asList(new Troop(Renegade.class, 120))); + UTUMNO.troops = new ArrayList<>(Arrays.asList(new Troop(LOTREntityUtumnoOrc.class, 90), new Troop(LOTREntityUtumnoOrcArcher.class, 40), new Troop(LOTREntityUtumnoSnowTroll.class, 15), new Troop(LOTREntityUtumnoFireWarg.class, 15), new Troop(LOTREntityUtumnoIceWarg.class, 15), new Troop(LOTREntityUtumnoObsidianWarg.class, 15), new Troop(LOTREntityUtumnoTroll.class, 10))); + RENEGADE.troops = new ArrayList<>(Arrays.asList(new Troop(Renegade.class, 140))); } public static Entity get_boss_entity(WarbandFaction faction, World world) { @@ -241,7 +242,7 @@ public enum WarbandFaction { ItemStack boots = item(LOTRMod.bootsBlackUruk, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack legs = item(LOTRMod.legsBlackUruk, LOTREnchantment.protectRanged3); ItemStack body = item(LOTRMod.bodyBlackUruk, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetBlackUruk, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetMorgul, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = item(LOTRMod.morgulBlade, LOTREnchantment.strong4, LOTREnchantment.meleeReach1, LOTREnchantment.meleeSpeed1); set_equipment(boss_entity, weapon, boots, legs, body, helmet); set_attributes(boss_entity, default_boss_hp, default_boss_speed, default_boss_damage_boost); @@ -252,7 +253,7 @@ public enum WarbandFaction { ItemStack boots = item(LOTRMod.bootsGondor, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack legs = item(LOTRMod.legsGondor, LOTREnchantment.protectRanged3); ItemStack body = item(LOTRMod.bodyGondor, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetGondor, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetGondorWinged, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; switch (Warband.random.nextInt(3)) { case 0: weapon = item(LOTRMod.swordGondor, LOTREnchantment.meleeSpeed1); break; @@ -317,10 +318,10 @@ public enum WarbandFaction { } public static Entity get_rivendell_boss(World world) { LOTREntityRivendellWarrior boss_entity = new LOTREntityRivendellWarrior(world); - ItemStack boots = item(LOTRMod.bootsRivendell, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(LOTRMod.legsRivendell, LOTREnchantment.protectRanged3); - ItemStack body = item(LOTRMod.bodyRivendell, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetRivendell, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack boots = item(LOTRMod.bootsGondolin, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(LOTRMod.legsGondolin, LOTREnchantment.protectRanged3); + ItemStack body = item(LOTRMod.bodyGondolin, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetGondolin, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack ranged_weapon = item(LOTRMod.rivendellBow, LOTREnchantment.rangedStrong3, LOTREnchantment.rangedStrong2); ItemStack melee_weapon = null; switch (Warband.random.nextInt(3)) { @@ -334,19 +335,13 @@ public enum WarbandFaction { return boss_entity; } public static Entity get_lindon_boss(World world) { - LOTREntityHighElfWarrior boss_entity = new LOTREntityHighElfWarrior(world); - ItemStack boots = item(LOTRMod.bootsHighElven, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(LOTRMod.legsHighElven, LOTREnchantment.protectRanged3); - ItemStack body = item(LOTRMod.bodyHighElven, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetHighElven, LOTREnchantment.protect1, LOTREnchantment.protectFire3); - ItemStack ranged_weapon = item(LOTRMod.highElvenBow, LOTREnchantment.rangedStrong3, LOTREnchantment.rangedStrong2); - ItemStack melee_weapon = null; - switch (Warband.random.nextInt(2)) { - case 0: melee_weapon = item(LOTRMod.swordHighElven, LOTREnchantment.meleeSpeed1); break; - case 1: melee_weapon = item(LOTRMod.spearHighElven, LOTREnchantment.meleeReach1); break; - } + LOTREntityHighElfWarrior boss_entity = new Sirrandrai(world); + ItemStack boots = item(LOTRMod.bootsGondolin, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(LOTRMod.legsGondolin, LOTREnchantment.protectRanged3); + ItemStack body = item(LOTRMod.bodyGondolin, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetGondolin, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack melee_weapon = item(LOTRMod.swordGondolin, LOTREnchantment.meleeSpeed1); set_equipment(boss_entity, melee_weapon, boots, legs, body, helmet); - set_equipment(boss_entity, ranged_weapon, boots, legs, body, helmet); set_attributes(boss_entity, default_boss_hp, default_boss_speed, default_boss_damage_boost); return boss_entity; } @@ -395,9 +390,9 @@ public enum WarbandFaction { } public static Entity get_angmar_boss(World world) { LOTREntityAngmarOrc boss_entity = new LOTREntityAngmarOrc(world); - ItemStack boots = item(LOTRMod.bootsAngmar, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(LOTRMod.legsAngmar, LOTREnchantment.protectRanged3); - ItemStack body = item(LOTRMod.bodyAngmar, LOTREnchantment.protectFire3); + ItemStack boots = item(LOTRMod.bootsMorgul, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(LOTRMod.legsMorgul, LOTREnchantment.protectRanged3); + ItemStack body = item(LOTRMod.bodyMorgul, LOTREnchantment.protectFire3); ItemStack helmet = item(LOTRMod.helmetAngmar, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; switch (Warband.random.nextInt(5)) { @@ -498,10 +493,10 @@ public enum WarbandFaction { } public static Entity get_durins_folk_boss(World world) { LOTREntityDwarfWarrior boss_entity = new LOTREntityDwarfWarrior(world); - ItemStack boots = item(LOTRMod.bootsDwarven, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(LOTRMod.legsDwarven, LOTREnchantment.protectRanged3); - ItemStack body = item(LOTRMod.bodyDwarven, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetDwarven, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack boots = item(LOTRMod.bootsDwarvenGold, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(LOTRMod.legsDwarvenGold, LOTREnchantment.protectRanged3); + ItemStack body = item(LOTRMod.bodyDwarvenGold, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetDwarvenGold, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; switch (Warband.random.nextInt(3)) { case 0: weapon = item(LOTRMod.swordDwarven, LOTREnchantment.meleeSpeed1); break; @@ -564,14 +559,8 @@ public enum WarbandFaction { ItemStack boots = item(LOTRMod.bootsUruk, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack legs = item(LOTRMod.legsUruk, LOTREnchantment.protectRanged3); ItemStack body = item(LOTRMod.bodyUruk, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetUruk, LOTREnchantment.protect1, LOTREnchantment.protectFire3); - ItemStack weapon = null; - switch (Warband.random.nextInt(4)) { - case 0: weapon = item(LOTRMod.scimitarBlackUruk, LOTREnchantment.strong4, LOTREnchantment.meleeSpeed1); break; - case 1: weapon = item(LOTRMod.spearBlackUruk, LOTREnchantment.strong4, LOTREnchantment.meleeReach1); break; - case 2: weapon = item(LOTRMod.hammerBlackUruk, LOTREnchantment.strong4, LOTREnchantment.knockback2); break; - case 3: weapon = item(LOTRMod.battleaxeBlackUruk, LOTREnchantment.strong4, LOTREnchantment.meleeReach1, LOTREnchantment.knockback1); break; - } + ItemStack helmet = item(LOTRMod.helmetUrukBerserker, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack weapon = item(LOTRMod.scimitarUrukBerserker, LOTREnchantment.strong4, LOTREnchantment.meleeSpeed1); set_equipment(boss_entity, weapon, boots, legs, body, helmet); set_attributes(boss_entity, default_boss_hp, default_boss_speed, default_boss_damage_boost); return boss_entity; @@ -581,7 +570,7 @@ public enum WarbandFaction { ItemStack boots = item(LOTRMod.bootsUruk, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack legs = item(LOTRMod.legsUruk, LOTREnchantment.protectRanged3); ItemStack body = item(LOTRMod.bodyUruk, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetUruk, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetUrukBerserker, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = item(CinderLoE.whip, LOTREnchantment.strong4, LOTREnchantment.meleeReach1, LOTREnchantment.meleeSpeed1); set_equipment(boss_entity, weapon, boots, legs, body, helmet); set_attributes(boss_entity, default_boss_hp, default_boss_speed, 15.0D); @@ -624,7 +613,7 @@ public enum WarbandFaction { ItemStack boots = item(LOTRMod.bootsRhunGold, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack legs = item(LOTRMod.legsRhunGold, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); ItemStack body = item(LOTRMod.bodyRhunGold, LOTREnchantment.protect1, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetRhunGold, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetRhunWarlord, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; switch (Warband.random.nextInt(3)) { case 0: weapon = item(LOTRMod.swordRhun, LOTREnchantment.strong4, LOTREnchantment.meleeSpeed1); break; @@ -637,16 +626,15 @@ public enum WarbandFaction { } public static Entity get_umbar_boss(World world) { LOTREntityUmbarWarrior boss_entity = new LOTREntityUmbarWarrior(world); - ItemStack boots = item(LOTRMod.bootsUmbar, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(LOTRMod.legsUmbar, LOTREnchantment.protectRanged3); - ItemStack body = item(LOTRMod.bodyUmbar, LOTREnchantment.protectFire3); - ItemStack helmet = item(LOTRMod.helmetUmbar, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack boots = item(LOTRMod.bootsBlackNumenorean, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(LOTRMod.legsBlackNumenorean, LOTREnchantment.protectRanged3); + ItemStack body = item(LOTRMod.bodyBlackNumenorean, LOTREnchantment.protectFire3); + ItemStack helmet = item(LOTRMod.helmetBlackNumenorean, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; - switch (Warband.random.nextInt(4)) { - case 0: weapon = item(LOTRMod.scimitarNearHarad, LOTREnchantment.meleeSpeed1); break; - case 1: weapon = item(LOTRMod.spearNearHarad, LOTREnchantment.meleeReach1); break; - case 2: weapon = item(LOTRMod.poleaxeNearHarad, LOTREnchantment.strong4, LOTREnchantment.knockback1); break; - case 3: weapon = item(LOTRMod.maceNearHarad, LOTREnchantment.knockback2); break; + switch (Warband.random.nextInt(3)) { + case 0: weapon = item(LOTRMod.swordBlackNumenorean, LOTREnchantment.meleeSpeed1); break; + case 1: weapon = item(LOTRMod.spearBlackNumenorean, LOTREnchantment.meleeReach1); break; + case 2: weapon = item(LOTRMod.maceBlackNumenorean, LOTREnchantment.knockback2); break; } set_equipment(boss_entity, weapon, boots, legs, body, helmet); set_attributes(boss_entity, default_boss_hp, default_boss_speed, default_boss_damage_boost); @@ -700,10 +688,10 @@ public enum WarbandFaction { } public static Entity get_limwaith_boss(World world) { LimwaithWarrior boss_entity = new LimwaithWarrior(world); - ItemStack boots = item(CinderLoE.bootsLimwaith, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); - ItemStack legs = item(CinderLoE.legsLimwaith, LOTREnchantment.protectRanged3); - ItemStack body = item(CinderLoE.bodyLimwaith, LOTREnchantment.protectFire3); - ItemStack helmet = item(CinderLoE.helmetLimwaith, LOTREnchantment.protect1, LOTREnchantment.protectFire3); + ItemStack boots = item(CinderLoE.bootsboneLimwaith, LOTREnchantment.protect1, LOTREnchantment.protectRanged3); + ItemStack legs = item(CinderLoE.legsboneLimwaith, LOTREnchantment.protectRanged3); + ItemStack body = item(CinderLoE.bodyboneLimwaith, LOTREnchantment.protectFire3); + ItemStack helmet = item(CinderLoE.helmetboneLimwaith, LOTREnchantment.protect1, LOTREnchantment.protectFire3); ItemStack weapon = null; switch (Warband.random.nextInt(3)) { case 0: weapon = item(CinderLoE.truncheonLimwaith, LOTREnchantment.meleeSpeed1); break; diff --git a/src/main/java/com/zivilon/cinder_loe/world/event/WarbandTickHandler.java b/src/main/java/com/zivilon/cinder_loe/world/event/WarbandTickHandler.java index 1378811..a7aff76 100644 --- a/src/main/java/com/zivilon/cinder_loe/world/event/WarbandTickHandler.java +++ b/src/main/java/com/zivilon/cinder_loe/world/event/WarbandTickHandler.java @@ -1,5 +1,7 @@ package com.zivilon.cinder_loe.world.event; +import com.zivilon.cinder_loe.CinderLoE_Config; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; @@ -23,6 +25,7 @@ public class WarbandTickHandler { public void run_task() { if (Warband.last_warband_timestamp > (System.currentTimeMillis() / 1000L) - (60*60*4)) return; // Do not spawn warband if less than 4 hours since last one if (Warband.random.nextInt(10) != 0) return; + if (!CinderLoE_Config.warbands_enabled) return; Warband.initialize_warband(); } } diff --git a/src/main/resources/assets/cinder_loe/lang/en_US.lang b/src/main/resources/assets/cinder_loe/lang/en_US.lang index ee8a41d..c1ec776 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -345,9 +345,14 @@ lotr.enchant.meleeReach2=Lengthy lotr.enchant.meleeSpeed2=Rapid lotr.enchant.rangedStrong4=Forceful lotr.enchant.fireRepair=Ashen -lotr.enchant.fireRepair.desc=Repairs armor durability while on fire +lotr.enchant.fireRepair.desc=Repairs durability while on fire lotr.enchant.swiftness=Windy -lotr.enchant.swiftness.desc=+5% speed per armor piece +lotr.enchant.swiftness.desc=1.05x movement speed +lotr.enchant.stealth=Cloaked +lotr.enchant.stealth.desc=Reduces NPC detection range +lotr.enchant.mountArmor=Heavy +lotr.enchant.mountArmor.desc=+1 mount armor + lotr.unit.Banner_Warg=Warg Rider Banner lotr.unit.Banner_Horse=Mounted Banner Bearer @@ -385,4 +390,4 @@ item.lotr:mugOrcBrew.name=Concentrated Orc Draught item.lotr:mugHumanBrew.name=Athelas Tea item.lotr:mugDwarfBrew.name=Dwarven Stout -potion.herbal_poisoning=Herbal Poisoning +potion.overdose=Overdose diff --git a/src/main/resources/assets/cinder_loe/misc/overdose.png b/src/main/resources/assets/cinder_loe/misc/overdose.png new file mode 100644 index 0000000..f04b592 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/misc/overdose.png differ diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index cd98861..2a39c17 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -52,6 +52,7 @@ "MixinLOTREntityNPC", "MixinFoodStats", "MixinLOTRItemMug", + "MixinLOTREntityHorse", "MixinLOTRGuiMap", "MixinLOTREntityAIOrcSkirmish" ],