public AimAction(BattleSoldier soldier, BattleSoldier target, RangedWeapon weapon, ConcurrentQueue <string> log) { _soldier = soldier; _target = target; _weapon = weapon; _log = log; }
public MoveAction(BattleSoldier soldier, BattleGrid grid, Tuple <int, int> newLocation, ConcurrentBag <MoveResolution> resultList) { _soldier = soldier; _grid = grid; _newLocation = newLocation; _resultList = resultList; }
public WoundResolution(BattleSoldier inflicter, WeaponTemplate weapon, BattleSoldier sufferer, float damage, HitLocation hitLocation) { Inflicter = inflicter; Weapon = weapon; Suffererer = sufferer; Damage = damage; HitLocation = hitLocation; }
public ShootAction(BattleSoldier shooter, RangedWeapon weapon, BattleSoldier target, float range, int numberOfShots, bool useBulk, ConcurrentBag <WoundResolution> resultList, ConcurrentQueue <string> log) { _soldier = shooter; _weapon = weapon; _target = target; _range = range; _numberOfShots = numberOfShots; _useBulk = useBulk; _resultList = resultList; _log = log; }
private void RemoveSoldier(BattleSoldier soldier, BattleSquad squad) { squad.RemoveSoldier(soldier); _grid.RemoveSoldier(soldier.Soldier.Id); BattleView.RemoveSoldier(soldier.Soldier.Id); _soldierBattleSquadMap.Remove(soldier.Soldier.Id); if (squad.Soldiers.Count == 0) { RemoveSquad(squad); } }
public MeleeAttackAction(BattleSoldier attacker, BattleSoldier target, MeleeWeapon weapon, bool didMove, ConcurrentBag <WoundResolution> resultList, ConcurrentQueue <string> log) { _attacker = attacker; _target = target; _weapon = weapon; _didMove = didMove; _resultList = resultList; _log = log; }
private void WoundResolver_OnSoldierFall(BattleSoldier fallenSoldier, BattleSoldier inflicter, WeaponTemplate weapon) { _casualtyMap[fallenSoldier.Soldier.Id] = fallenSoldier; if (!fallenSoldier.BattleSquad.IsPlayerSquad) { // give the inflicter credit for downing this enemy // WARNING: this will lead to multi-counting in some cases // I may later try to divide credit, but having multiple soldiers // claim credit feels pseudo-realistic for now CreditSoldierForKill(inflicter, weapon); } }
private static string GetSoldierDetails(BattleSoldier soldier) { string report = soldier.Soldier.Name + "\n"; foreach (RangedWeapon weapon in soldier.RangedWeapons) { report += weapon.Template.Name + "\n"; } report += soldier.Armor.Template.Name + "\n"; foreach (HitLocation hl in soldier.Soldier.Body.HitLocations) { if (hl.Wounds.WoundTotal != 0) { report += hl.ToString() + "\n"; } } report += "\n"; return(report); }
private void WoundResolver_OnSoldierDeath(BattleSoldier casualty, BattleSoldier inflicter, WeaponTemplate weapon) { _casualtyMap[casualty.Soldier.Id] = casualty; if (casualty.BattleSquad.IsPlayerSquad) { // add death note to soldier history, though we currently just delete it // we'll probably want it later GameSettings.Chapter.PlayerSoldierMap[casualty.Soldier.Id] .AddEntryToHistory($"Killed in battle with the {_opposingFaction.Name} by a {weapon.Name}"); } else { // give the inflicter credit for downing this enemy // WARNING: this will lead to multi-counting in some cases // I may later try to divide credit, but having multiple soldiers // claim credit feels pseudo-realistic for now CreditSoldierForKill(inflicter, weapon); } }
public void BattleView_OnSoldierPointerEnter(int soldierId) { BattleSquad battleSquad = _soldierBattleSquadMap[soldierId]; if (_hoveredBattleSquad != null && _hoveredBattleSquad.Id != battleSquad.Id && battleSquad.Id != _selectedBattleSquad?.Id) { BattleView.HighlightSoldiers(_hoveredBattleSquad.Soldiers .Select(s => s.Soldier.Id), false, Color.clear); } if (battleSquad.Id != _selectedBattleSquad?.Id) { BattleView.HighlightSoldiers(battleSquad.Soldiers.Select(s => s.Soldier.Id), true, Color.cyan); _hoveredBattleSquad = battleSquad; } BattleSoldier soldier = battleSquad.Soldiers.First(s => s.Soldier.Id == soldierId); Tooltip.ShowTooltip(GetSoldierDetails(soldier)); }
private HitLocation DetermineHitLocation(BattleSoldier soldier) { // we're using the "lottery ball" approach to randomness here, where each point of probability // for each available body party defines the size of the random linear distribution // TODO: factor in cover/body position // int roll = RNG.GetIntBelowMax(0, soldier.Soldier.Body.TotalProbabilityMap[soldier.Stance]); foreach (HitLocation location in soldier.Soldier.Body.HitLocations) { int locationChance = location.Template.HitProbabilityMap[(int)soldier.Stance]; if (roll < locationChance) { return(location); } else { // this is basically an easy iterative way to figure out which body part on the "chart" the roll matches roll -= locationChance; } } // this should never happen throw new InvalidOperationException("Could not determine a hit location"); }
public ReadyRangedWeaponAction(BattleSoldier soldier, RangedWeapon weapon) { _soldier = soldier; _weapon = weapon; }
public ReadyMeleeWeaponAction(BattleSoldier soldier, MeleeWeapon weapon) { _soldier = soldier; _weapon = weapon; }
public MoveResolution(BattleSoldier soldier, BattleGrid grid, Tuple <int, int> newLocation) { Soldier = soldier; Grid = grid; NewLocation = newLocation; }
private void CreditSoldierForKill(BattleSoldier inflicter, WeaponTemplate weapon) { GameSettings.Chapter.PlayerSoldierMap[inflicter.Soldier.Id] .AddKill(_opposingFaction.Id, weapon.Id); inflicter.EnemiesTakenDown++; }
private void MoveResolver_OnRetreat(BattleSoldier soldier) { Log(false, "<b>" + soldier.Soldier.Name + " has retreated from the battlefield</b>"); _casualtyMap[soldier.Soldier.Id] = soldier; }