static void Postfix(ref Agent.UsageDirection __result, Formation formation, Agent unit, ArrangementOrderEnum orderEnum) { if (!formation.QuerySystem.IsCavalryFormation && !formation.QuerySystem.IsRangedCavalryFormation) { switch (orderEnum) { case ArrangementOrderEnum.Line: case ArrangementOrderEnum.Loose: { float currentTime = MBCommon.TimeType.Mission.GetTime(); float lastMeleeAttackTime = unit.LastMeleeAttackTime; float lastMeleeHitTime = unit.LastMeleeHitTime; float lastRangedHit = unit.LastRangedHitTime; if ((currentTime - lastMeleeAttackTime < 4f) || (currentTime - lastMeleeHitTime < 4f)) { __result = Agent.UsageDirection.None; } else if ((currentTime - lastRangedHit < 10f) || formation.QuerySystem.UnderRangedAttackRatio >= 0.1f) { __result = Agent.UsageDirection.DefendDown; } else { __result = Agent.UsageDirection.None; } break; } } } }
static void Postfix(ref Agent.UsageDirection __result, Formation formation, Agent unit, ArrangementOrderEnum orderEnum) { if (!formation.QuerySystem.IsCavalryFormation && !formation.QuerySystem.IsRangedCavalryFormation) { float currentTime = Mission.Current.CurrentTime; if (currentTime - unit.LastRangedAttackTime < 7f) { __result = Agent.UsageDirection.None; return; } switch (orderEnum) { case ArrangementOrderEnum.Line: case ArrangementOrderEnum.Loose: { //float currentTime = MBCommon.TimeType.Mission.GetTime(); float lastMeleeAttackTime = unit.LastMeleeAttackTime; float lastMeleeHitTime = unit.LastMeleeHitTime; float lastRangedHit = unit.LastRangedHitTime; if ((currentTime - lastMeleeAttackTime < 4f) || (currentTime - lastMeleeHitTime < 4f)) { __result = Agent.UsageDirection.None; return; } if (Mission.Current.MissionTeamAIType == Mission.MissionTeamAITypeEnum.FieldBattle && (((currentTime - lastRangedHit < 2f) || formation.QuerySystem.UnderRangedAttackRatio >= 0.08f))) { __result = Agent.UsageDirection.DefendDown; return; } //else //{ // __result = Agent.UsageDirection.None; //} break; } } } }