public TDAttacker(AttackerTypes t, int Level) { // get attacker template for enum TDAttacker a = TDResources.Attackers[((int)t - 1)]; this.Name = a.Name; this.MainColor = Color.Red; if (a.MainImage != null) { this.MainImage = a.MainImage; } // adjust stats for level // HP - quickly increase this.HPMax = a.HPMax + (Level * 10); this.HPCurrent = this.HPMax; // Range - slowly increase this.Range = (a.Range * 2) + (Level / 5); // Speed - slowly increase this.SpeedMax = Math.Max(1, (a.SpeedMax + Level) / 4); this.SpeedCurrent = this.SpeedMax; // Damage - increase linearly this.BulletDamage = (a.BulletDamage / 10) + (Level); // bullet speed this.BulletSpeed = a.BulletSpeed; // cooldown remains constant this.Cooldown = new TimeSpan(0, 0, 0, 0, (int)(a.Cooldown.TotalMilliseconds * 100)); // cost (loot) this.Cost = 5 + ((Level - 1) * 2); }
private double GetModifier() { var stablist = AttackerTypes.Where(x => x.Name == move.Value); double stab = 1; if (stablist.Any()) { stab = 1.5; } var typeEffectiveness = setEffectiveness(); double critical = 1; if (rng.Next(0, 100) < 10) { IsCritical = true; critical = 2; } double other = /*rng.NextDouble() * 2*/ 1; double random = (double)rng.Next(85, 100) / 100; double mod = stab * typeEffectiveness * critical * other * random; return(mod); }
private void GenerateAttackersForLevel(int lvl, List <TDPath> Paths) { // waves this._WaveCount = 9 + (lvl); if (testing) { _WaveCount = 0; } // wave attacker type bool mixed = (TDMath.D(100) > 70); // 30% mixed // attackers per wave int attPerWave = 5 + TDMath.D(10 * lvl); if (testing) { attPerWave = 0; } // if 80, then betwen 41 and 80; int ThisWaveDelay = (WaveDelay / 2) + TDMath.D(WaveDelay / 2); if (testing) { ThisWaveDelay = WaveDelay; } int MaxDelay = 0; // for each wave for (int i = 0; i < this._WaveCount; i++) { // set the type and path for this wave AttackerTypes t = GetWeightedAttackerType(false); TDPath p = Paths[TDMath.D(Paths.Count) - 1]; // vary the attacker separation for this wave (between 1/2 and full value) int AttackerDelayWithinThisWave = (AttackerDelayWithinWave / 2) + TDMath.D((AttackerDelayWithinWave / 2)); if (testing) { AttackerDelayWithinThisWave = AttackerDelayWithinWave; } for (int j = 0; j < attPerWave; j++) { // check for mixed attacker type if (mixed && lvl > 3) // don't mix until lvl 4+ { // randomized the type for the next attacker t = GetWeightedAttackerType(true); p = Paths[TDMath.D(Paths.Count) - 1]; } // generate the new attacker TDAttacker a = new TDAttacker(t, lvl); a.WaveIndex = i + 1; int delayMS = Math.Max(1, (i * ThisWaveDelay) + (j * AttackerDelayWithinThisWave)); // slightly stagger each attacker within the wave (j) a.Effects.Add(new TDEffect(TDEffectTypes.WaveDelay, 0, new TimeSpan(0, 0, 0, 0, delayMS), false)); a.SetPath(p); this.Attackers.Add(a); // remember the MaxDelay for the Boss MaxDelay = Math.Max(MaxDelay, delayMS); } } // and finally, add the level boss TDAttacker boss = new TDAttacker(AttackerTypes.Boss, lvl + 10); boss.Size += 4; boss.HPMax = boss.HPMax * 6; boss.HPCurrent = boss.HPMax; int AdditionalBossDelay = 500; if (testing) { AdditionalBossDelay = 10000; } boss.Effects.Add(new TDEffect(TDEffectTypes.WaveDelay, 0, new TimeSpan(0, 0, 0, 0, MaxDelay + AdditionalBossDelay), false)); // 1/2 second after last attacker TDPath pBoss = Paths[TDMath.D(Paths.Count) - 1]; boss.SetPath(pBoss); this.Attackers.Add(boss); }
///////////////////////////////////////////// /// Functions ///////////////////////////////////////////// //constructor public ChooseToDefeatTask(DefenderSandbox defender, AttackerTypes attackerType) { this.defender = defender; this.attackerType = attackerType; }