public override TankUpdate Update(IGameState gameState) { TankUpdate tankUpdate = new TankUpdate(); tankUpdate.TankColor = GetRandomColor(); if (gameState.Foes.Any() && gameState.Goals.Any()) { var target = LocationProvider.GetLocation(375,375); if (target != null) { tankUpdate.ShotTarget = target; Bullet = new Bullet { Damage = 0, Freeze = 0, SplashRange = 0, GravityDuration = 1, GravityStrength = 0.01 }; tankUpdate.Bullet = Bullet; } } return tankUpdate; }
private static void ApplyFreeze(IGameTank gameTank, Bullet bullet, List<Monster> foesInRange) { foreach (var monster in foesInRange) { monster.Speed *= monster.Health / (double)(bullet.Freeze * 3 + monster.Health); gameTank.Freeze += bullet.Freeze; } }
private void ChangeBulletPower(IFoe foe) { var range = GetDistanceFromTank(foe) + 1; var damage = (int)(2000 / range); var freeze = 0; if (damage < foe.Health) { //damage /= 2; //freeze = damage; freeze = damage - 1; damage = 1; } Bullet = new Bullet { Damage = damage, Freeze = freeze }; }
private void ApplyDamage(IGameTank gameTank, Bullet bullet, List<Monster> foesInRange) { foreach (var monster in foesInRange) { monster.Health -= bullet.Damage; if (monster.OnHitAbility != null) { monster.OnHitAbility.Invoke(_game.GameState, bullet.Damage); } gameTank.Damage += bullet.Damage; gameTank.MaxDamageDealt = Math.Max(bullet.Damage, gameTank.MaxDamageDealt); if (monster.Health <= 0) { KilledMonster(gameTank, monster); } } }
private void ChangeBulletPower(IFoe foe) { var range = GetDistanceFromTank(foe) + 1; var damage = (int)(1000 / range); Bullet = new Bullet { Damage = damage, Freeze = 0, SplashRange = 0 }; }
private void ChangeBulletPower(ILocation target, IGameState gameState) { var foes = GetFoesInRange(target.X, target.Y, gameState, _range); if (foes.Any()) { var damage = foes.Max(foe => foe.Health); var range = GetDistanceFromTank(target) + 1; Bullet = new Bullet { Damage = damage, Freeze = -0, SplashRange = _range }; } else { Bullet = new Bullet { Damage = 0, Freeze = 0, SplashRange = 0 }; } }