Page MenuHomeWildfire Games

Perform attack only if attacker can really reach the target
AbandonedPublic

Authored by Silier on Jan 6 2020, 11:54 AM.

Details

Reviewers
wraitii
Summary

When attacker is in attacking animation, target may be already out of range what sometimes leads to attacker dealing damage to target that is no longer in attacker`s attack range.

Steps to reproduce:
attacker: melee unit
target: fleeing unit

notice fleeing unit receives damage while is clearly out of range of attacker

Test Plan

Check that make sense and it is correct.

Event Timeline

Silier created this revision.Jan 6 2020, 11:54 AM
Silier edited the summary of this revision. (Show Details)Jan 6 2020, 11:58 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/961/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/57/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 780| 780| 					this.FinishOrder();
| 781| 781| 					return;
| 782| 782| 				}
| 783|    |-				else
| 784|    |-				{
|    | 783|+				
| 785| 784| 					this.SetNextState("GARRISON.APPROACHING");
| 786| 785| 					return;
| 787|    |-				}
|    | 786|+				
| 788| 787| 			}
| 789| 788| 
| 790| 789| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1052|1052| 			},
|1053|1053| 		},
|1054|1054| 
|1055|    |-		"GARRISON":{
|    |1055|+		"GARRISON": {
|1056|1056| 			"APPROACHING": {
|1057|1057| 				"enter": function() {
|1058|1058| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2022|2022| 
|2023|2023| 				"Attacked": function(msg) {
|2024|2024| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2025|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2026|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2025|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2026|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2027|2027| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2028|2028| 				},
|2029|2029| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2757|2757| 					{
|2758|2758| 						// The building was already finished/fully repaired before we arrived;
|2759|2759| 						// let the ConstructionFinished handler handle this.
|2760|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2760|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2761|2761| 						return true;
|2762|2762| 					}
|2763|2763| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2757|2757| 					{
|2758|2758| 						// The building was already finished/fully repaired before we arrived;
|2759|2759| 						// let the ConstructionFinished handler handle this.
|2760|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2760|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2761|2761| 						return true;
|2762|2762| 					}
|2763|2763| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3277|3277| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3278|3278| 
|3279|3279| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3280|    |-							// only used for domestic animals
|    |3280|+		// only used for domestic animals
|3281|3281| 	},
|3282|3282| };
|3283|3283| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 
|3335|3335| UnitAI.prototype.IsAnimal = function()
|3336|3336| {
|3337|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3337|+	return (!!this.template.NaturalBehaviour);
|3338|3338| };
|3339|3339| 
|3340|3340| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3450|3450| 		{
|3451|3451| 			let index = this.GetCurrentState().indexOf(".");
|3452|3452| 			if (index != -1)
|3453|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3453|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3454|3454| 			this.Stop(false);
|3455|3455| 		}
|3456|3456| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3506|3506| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3507|3507| 			continue;
|3508|3508| 		if (i == 0)
|3509|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3509|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3510|3510| 		else
|3511|3511| 			this.orderQueue.splice(i, 1);
|3512|3512| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3506|3506| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3507|3507| 			continue;
|3508|3508| 		if (i == 0)
|3509|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3509|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3510|3510| 		else
|3511|3511| 			this.orderQueue.splice(i, 1);
|3512|3512| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3590|3590| };
|3591|3591| 
|3592|3592| 
|3593|    |-//// FSM linkage functions ////
|    |3593|+// // FSM linkage functions ////
|3594|3594| 
|3595|3595| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3596|3596| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3760|3760| 				continue;
|3761|3761| 			if (this.orderQueue[i].type == type)
|3762|3762| 				continue;
|3763|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3763|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3764|3764| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3765|3765| 			return;
|3766|3766| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3760|3760| 				continue;
|3761|3761| 			if (this.orderQueue[i].type == type)
|3762|3762| 				continue;
|3763|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3763|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3764|3764| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3765|3765| 			return;
|3766|3766| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4002|4002| 	if (data.timerRepeat === undefined)
|4003|4003| 		this.timer = undefined;
|4004|4004| 
|4005|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4005|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4006|4006| };
|4007|4007| 
|4008|4008| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4002|4002| 	if (data.timerRepeat === undefined)
|4003|4003| 		this.timer = undefined;
|4004|4004| 
|4005|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4005|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4006|4006| };
|4007|4007| 
|4008|4008| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4047|4047| 	// TODO: This is a bit inefficient since every unit listens to every
|4048|4048| 	// construction message - ideally we could scope it to only the one we're building
|4049|4049| 
|4050|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4050|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4051|4051| };
|4052|4052| 
|4053|4053| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4047|4047| 	// TODO: This is a bit inefficient since every unit listens to every
|4048|4048| 	// construction message - ideally we could scope it to only the one we're building
|4049|4049| 
|4050|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4050|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4051|4051| };
|4052|4052| 
|4053|4053| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4072|4072| 
|4073|4073| UnitAI.prototype.OnAttacked = function(msg)
|4074|4074| {
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4076|4076| };
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4072|4072| 
|4073|4073| UnitAI.prototype.OnAttacked = function(msg)
|4074|4074| {
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4076|4076| };
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4081|4081| };
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4081|4081| };
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4086|4086| };
|4087|4087| 
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4086|4086| };
|4087|4087| 
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4094|4094| };
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4099|4099| };
|4100|4100| 
|4101|4101| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4099|4099| };
|4100|4100| 
|4101|4101| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4098|4098| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4099|4099| };
|4100|4100| 
|4101|    |-//// Helper functions to be called by the FSM ////
|    |4101|+// // Helper functions to be called by the FSM ////
|4102|4102| 
|4103|4103| UnitAI.prototype.GetWalkSpeed = function()
|4104|4104| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4766|4766| UnitAI.prototype.AttackEntityInZone = function(ents)
|4767|4767| {
|4768|4768| 	var target = ents.find(target =>
|4769|    |-		this.CanAttack(target)
|4770|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4769|+		this.CanAttack(target) &&
|    |4770|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4771|4771| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4772|4772| 	);
|4773|4773| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4767|4767| {
|4768|4768| 	var target = ents.find(target =>
|4769|4769| 		this.CanAttack(target)
|4770|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4771|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4770|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4771|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4772|4772| 	);
|4773|4773| 	if (!target)
|4774|4774| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4831|4831| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4832|4832| 	if (this.isGuardOf)
|4833|4833| 	{
|4834|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4834|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4835|4835| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4836|4836| 		if (cmpUnitAI && cmpAttack &&
|4837|4837| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4835|4835| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4836|4836| 		if (cmpUnitAI && cmpAttack &&
|4837|4837| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4838|    |-				return false;
|    |4838|+			return false;
|4839|4839| 	}
|4840|4840| 
|4841|4841| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4873|4873| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4874|4874| 	if (this.isGuardOf)
|4875|4875| 	{
|4876|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4876|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4877|4877| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4878|4878| 		if (cmpUnitAI && cmpAttack &&
|4879|4879| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4886|4886| 	return false;
|4887|4887| };
|4888|4888| 
|4889|    |-//// External interface functions ////
|    |4889|+// // External interface functions ////
|4890|4890| 
|4891|4891| UnitAI.prototype.SetFormationController = function(ent)
|4892|4892| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5042|5042| 	{
|5043|5043| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5044|5044| 			return;
|5045|    |-		else
|5046|    |-			this.RemoveGuard();
|    |5045|+		this.RemoveGuard();
|5047|5046| 	}
|5048|5047| 
|5049|5048| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5384|5384| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5385|5385| 	{
|5386|5386| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5387|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5387|+		if (cmpTrader.HasBothMarkets() &&
|5388|5388| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5389|5389| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5390|5390| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5665|5665| 				{
|5666|5666| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5667|5667| 					var targetClasses = this.order.data.targetClasses;
|5668|    |-					if (targetClasses.attack && cmpIdentity
|5669|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5668|+					if (targetClasses.attack && cmpIdentity &&
|    |5669|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5670|5670| 						continue;
|5671|5671| 					if (targetClasses.avoid && cmpIdentity
|5672|5672| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5668|5668| 					if (targetClasses.attack && cmpIdentity
|5669|5669| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5670|5670| 						continue;
|5671|    |-					if (targetClasses.avoid && cmpIdentity
|5672|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5671|+					if (targetClasses.avoid && cmpIdentity &&
|    |5672|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5673|5673| 						continue;
|5674|5674| 					// Only used by the AIs to prevent some choices of targets
|5675|5675| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5691|5691| 		{
|5692|5692| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5693|5693| 			var targetClasses = this.order.data.targetClasses;
|5694|    |-			if (cmpIdentity && targetClasses.attack
|5695|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5694|+			if (cmpIdentity && targetClasses.attack &&
|    |5695|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5696|5696| 				continue;
|5697|5697| 			if (cmpIdentity && targetClasses.avoid
|5698|5698| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5694|5694| 			if (cmpIdentity && targetClasses.attack
|5695|5695| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5696|5696| 				continue;
|5697|    |-			if (cmpIdentity && targetClasses.avoid
|5698|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5697|+			if (cmpIdentity && targetClasses.avoid &&
|    |5698|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5699|5699| 				continue;
|5700|5700| 			// Only used by the AIs to prevent some choices of targets
|5701|5701| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = { "x": x, "z": z};
|5855|5855| };
|5856|5856| 
|5857|5857| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = {"x": x, "z": z };
|5855|5855| };
|5856|5856| 
|5857|5857| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5878|5878| 	return false;
|5879|5879| };
|5880|5880| 
|5881|    |-//// Helper functions ////
|    |5881|+// // Helper functions ////
|5882|5882| 
|5883|5883| UnitAI.prototype.CanAttack = function(target)
|5884|5884| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6082|6082| 	return cmpPack && cmpPack.IsPacking();
|6083|6083| };
|6084|6084| 
|6085|    |-//// Formation specific functions ////
|    |6085|+// // Formation specific functions ////
|6086|6086| 
|6087|6087| UnitAI.prototype.IsAttackingAsFormation = function()
|6088|6088| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6087|6087| UnitAI.prototype.IsAttackingAsFormation = function()
|6088|6088| {
|6089|6089| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6090|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6091|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6090|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6091|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6092|6092| };
|6093|6093| 
|6094|6094| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6091|6091| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6092|6092| };
|6093|6093| 
|6094|    |-//// Animal specific functions ////
|    |6094|+// // Animal specific functions ////
|6095|6095| 
|6096|6096| UnitAI.prototype.MoveRandomly = function(distance)
|6097|6097| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 338| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1240| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|3907| »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4753| »   var·target·=·ents.find(target·=>·this.CanAttack(target));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4768| »   var·target·=·ents.find(target·=>
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4814| »   var·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4837| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2026| »   »   »   »   »   »   &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|3854| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|3938| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4770| »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|4771| »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5669| »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5672| »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5685| »   var·targets·=·this.GetTargetsFromUnit();
|    | [NORMAL] JSHintBear:
|    | 'targets' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5686| »   for·(var·targ·of·targets)
|    | [NORMAL] JSHintBear:
|    | 'targ' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5692| »   »   »   var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity);
|    | [NORMAL] JSHintBear:
|    | 'cmpIdentity' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5693| »   »   »   var·targetClasses·=·this.order.data.targetClasses;
|    | [NORMAL] JSHintBear:
|    | 'targetClasses' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5695| »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5698| »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5773| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5776| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5781| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [NORMAL] JSHintBear:
|    | 'cmpRanged' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5784| »   »   var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5785| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5795| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5798| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|6091| »   »   &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1479/display/redirect

Silier retitled this revision from Deal damage only if unit can really reach the target to Perform attack only if attacker can really reach the target.Jan 6 2020, 12:19 PM
Stan added a subscriber: Stan.Jan 6 2020, 12:25 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2006

Doesn't the fact that it isn't in range means it needs to chase it?

Silier added inline comments.Jan 6 2020, 4:12 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2006

Yes it is, but here are another aspects, like turret stance, guarding, forced order

Stan added inline comments.Jan 6 2020, 4:40 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2002

Shouldn't that return a boolean or something?

2006

Ah okay.

2011

Same here.

Silier added inline comments.Jan 6 2020, 4:45 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2002

its timer so does not matter what it returns

See "discussion" at D2160 ;)

elexis added a subscriber: elexis.EditedJan 6 2020, 5:36 PM

If you change melee units to not deal damage anymore under some conditions it will change the balance, I may remind of alpha 22 where players cried about skirmisher cavalry being OP following not dealing damage anymore when arrows missed their target, following receiving a buff to compensate that.
So the impact must be assessed.

I suppose this only changes behavior when

  • attacking opponent healers
  • attacking opponent women
  • hunting animals
  • enemy soldiers that were put to passive

?

Edit: Sure it doesnt apply to ranged units as well?

Silier added a comment.Jan 7 2020, 8:43 AM

Yes this applies to ranged attacks too.
And there is no range check later for it currently. So if target gets out of max range or while attacker is preparing or while missile is flying to target, it gets shot anyway. So max range for attacks is not what it is expected to be.

wraitii requested changes to this revision.Dec 10 2020, 9:52 AM
wraitii added a subscriber: wraitii.

Indeed, this is a duplicate of D2160 and breaks the game: see this very old ticket: #1537

I think it might be worth adding that as a comment on the check, or I fear every developer will eventually write this diff :p

This revision now requires changes to proceed.Dec 10 2020, 9:52 AM
Silier abandoned this revision.Apr 20 2023, 4:47 PM