Adjustment for multiple servitor defend mode.
Contributed by vass.
This commit is contained in:
		| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
| @@ -225,7 +225,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -240,7 +240,7 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		 | ||||
| 		if (_isDefending) | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 			allServitorsDefend(attacker); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @@ -248,6 +248,19 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void allServitorsDefend(Creature attacker) | ||||
| 	{ | ||||
| 		final Creature Owner = getActor().getOwner(); | ||||
| 		if ((Owner != null) && Owner.getActingPlayer().hasServitors()) | ||||
| 		{ | ||||
| 			Owner.getActingPlayer().getServitors().values().stream().filter(summon -> ((SummonAI) summon.getAI()).isDefending()).forEach(summon -> ((SummonAI) summon.getAI()).defendAttack(attacker)); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			defendAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private void avoidAttack(Creature attacker) | ||||
| 	{ | ||||
| 		// Don't move while casting. It breaks casting animation, but still casts the skill... looks so bugged. | ||||
| @@ -273,9 +286,9 @@ public class SummonAI extends PlayableAI implements Runnable | ||||
| 		} | ||||
| 		 | ||||
| 		final Summon summon = getActor(); | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false) && summon.getOwner().isInsideRadius3D(_actor, 2 * AVOID_RADIUS)) | ||||
| 		if ((summon.getOwner() != null) && (summon.getOwner() != attacker) && !summon.isMoving() && summon.canAttack(attacker, false)) | ||||
| 		{ | ||||
| 			summon.doAutoAttack(attacker); | ||||
| 			summon.doAttack(attacker); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment