mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 01:05:12 +00:00
Sync Tactical Chance with Stubborn Combat Policy
This commit is contained in:
1 parent
cda79db659
commit
aab5a9ca04
2 files changed
+14
-1
No files matched your search
@@ -71,6 +71,15 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
}
|
||||
addLabel(new GuiNpcLabel(25,"ai.combatpolicy", guiLeft + 150, guiTop + 165));
|
||||
addButton(new GuiNpcButton(25 ,guiLeft + 230, guiTop + 160, 60, 20, EnumCombatPolicy.names(), ai.combatPolicy.ordinal()));
|
||||
if (ai.combatPolicy == EnumCombatPolicy.Stubborn)
|
||||
{
|
||||
String label = "";
|
||||
label = "gui.combatchance";
|
||||
addLabel(new GuiNpcLabel(21, label, guiLeft + 300, guiTop + 140));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 380, guiTop + 135, 30, 20, ai.tacticalChance + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(1, 100, 5);
|
||||
}
|
||||
|
||||
getButton(17).setEnabled(this.ai.onAttack == 0);
|
||||
getButton(15).setEnabled(this.ai.onAttack == 0);
|
||||
@@ -91,6 +100,9 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
if(textfield.id == 3){
|
||||
ai.tacticalRadius = textfield.getInteger();
|
||||
}
|
||||
if(textfield.id == 4){
|
||||
ai.tacticalChance = textfield.getInteger();
|
||||
}
|
||||
if(textfield.id == 6){
|
||||
ai.distanceToMelee = textfield.getInteger();
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
break;
|
||||
case Stubborn:
|
||||
if (closerTargetFound && combatHandler.shouldChangeTarget(5.0)) {
|
||||
if (closerTargetFound && combatHandler.shouldChangeTarget((double) ai.tacticalChance / 100)) {
|
||||
setAttackTarget(attackingEntity);
|
||||
}
|
||||
break;
|
||||
@@ -719,6 +719,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break;
|
||||
case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break;
|
||||
case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break;
|
||||
// case Twist: this.tasks.addTask(this.taskCount++, aiResponse = new EntityAITwistTarget(this, 1.3D, this.ai.tacticalRadius)); break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user