private void copyFrom(BasicWeapon other) { this.NumAugmentSlots = other.NumAugmentSlots; this.BaseStats = other.BaseStats; this.ProjectileBitmap = other.ProjectileBitmap; this.ExplosionBitmap = other.ExplosionBitmap; }
// Adds the given items and returns the resultant Weapon public WeaponStats WithAugments(IEnumerable <WeaponAugmentTemplate> augments) { // Add up all the Stats of all the items WeaponAugmentTemplate overallAugment = this.BaseStats; foreach (WeaponAugmentTemplate augment in augments) { overallAugment = overallAugment.Plus(augment); } // Now do some last computations on the totals (like converting from rates to times) WeaponStats weapon = new WeaponStats(); // Attributes about when you may fire weapon.OwnersVelocityScale = 1; weapon.MaxAmmo = overallAugment.MaxAmmo; weapon.WarmupTime = 1 / overallAugment.WarmupRate; weapon.CooldownTime = 1 / overallAugment.CooldownRate; // Attributes of the projectile it launches, to determine when it hits Projectile templateProjectile = new Projectile(); templateProjectile.setVelocity(new double[] { 100, 0 }); templateProjectile.setRemainingFlightTime(overallAugment.FlightDuration); templateProjectile.setPenetration(0.5); templateProjectile.setNumExplosionsRemaining(overallAugment.MaxNumExplosions); templateProjectile.setHomingAccel(overallAugment.HomingAccel); templateProjectile.enableHomingOnCharacters(true); templateProjectile.enableHomingOnProjectiles(true); templateProjectile.setBoomerangAccel(0); templateProjectile.setShape(new GameCircle(10)); templateProjectile.setBitmap(this.ProjectileBitmap); weapon.TemplateProjectile = templateProjectile; // Attributes of the explosion it creates, to determine what happens in the area it hits Explosion templateExplosion = new Explosion(); templateExplosion.setDuration(overallAugment.ExplosionDuration); templateExplosion.setFriendlyFireEnabled(false); templateExplosion.setKnockbackAccel(0); templateExplosion.setShape(new GameCircle(overallAugment.ExplosionRadius)); templateExplosion.setBitmap(this.ExplosionBitmap); templateProjectile.setTemplateExplosion(templateExplosion); // Attributes of the stun that gets applied to characters caught in the explosion Stun templateStun = new Stun(); templateStun.setTimeMultiplier(1.0 / (overallAugment.TimestopWeight + 1)); templateStun.setDamagePerSecond(overallAugment.StunDamagePerSecond); templateStun.setAmmoDrain(0); templateStun.setDuration(overallAugment.StunDuration); templateExplosion.setTemplateStun(templateStun); return(weapon); }
public WeaponAugmentTemplate(WeaponAugmentTemplate original) { this.Name = original.Name; this.WarmupRate = original.WarmupRate; this.CooldownRate = original.CooldownRate; this.MaxAmmo = original.MaxAmmo; this.FlightDuration = original.FlightDuration; this.MaxNumExplosions = original.MaxNumExplosions; this.ExplosionDuration = original.ExplosionDuration; this.StunDuration = original.StunDuration; this.StunDamagePerSecond = original.StunDamagePerSecond; this.TimestopWeight = original.TimestopWeight; }
public WeaponAugmentTemplate Plus(WeaponAugmentTemplate other) { WeaponAugmentTemplate result = new WeaponAugmentTemplate(); result.Name = this.Name + " + " + other.Name; result.WarmupRate = this.WarmupRate + other.WarmupRate; result.CooldownRate = this.CooldownRate + other.CooldownRate; result.MaxAmmo = this.MaxAmmo + other.MaxAmmo; result.HomingAccel += this.HomingAccel + other.HomingAccel; result.FlightDuration = this.FlightDuration + other.FlightDuration; result.MaxNumExplosions = this.MaxNumExplosions + other.MaxNumExplosions; result.ExplosionRadius = this.ExplosionRadius + other.ExplosionRadius; result.ExplosionDuration = this.ExplosionDuration + other.ExplosionDuration; result.StunDuration = this.StunDuration + other.StunDuration; result.StunDamagePerSecond = this.StunDamagePerSecond + other.StunDamagePerSecond; result.TimestopWeight = this.TimestopWeight + other.TimestopWeight; return result; }
public WeaponAugment(WeaponAugmentTemplate template) { this.Template = template; }
private WeaponAugmentTemplate New(String name) { WeaponAugmentTemplate template = new WeaponAugmentTemplate(name); return(template); }