public Message(Player recipient,Player sender,string subject, string text) { this.recipient = recipient; this.sender = sender; this.subject = subject; this.text = text; this.unread = true; this.date = DateTime.Now; Recipient.Messages.Add(this); }
public Army(Player owner) { this.owner = owner; entities = new List<Entity>(); bonusAuraArmor = 1; bonusAuraRange = 1; bonusAuraAttackAir = 1; bonusAuraAttackGround = 1; bonusAuraHitpoints = 1; bonusAuraCooldown = 1; malusAuraArmor = 1; malusAuraRange = 1; malusAuraAttackAir = 1; malusAuraAttackGround = 1; malusAuraHitpoints = 1; malusAuraCooldown = 1; }
public Unit(UnitType t, Sector s, Player p, DateTime d) { this.type = t; this.sector = s; this.owner = p; this.date = d; this.action = UnitAction.None; this.hitpoints = Info.Hitpoints; this.number = 1; Sector.Units.Add(this); if (Owner != null) Owner.Units.Add(this); }
public bool IsAlly(Player p) { if (p == null) return false; if (this == p) return true; if (p.Alliance == null || !p.IsAccepted || this.Alliance == null || !this.IsAccepted) return false; return (p.Alliance == this.Alliance); }
public bool HasAHigherAllianceRank(Player p) { if (p.AllianceRank == AllianceRank.Level2 && allianceRank == AllianceRank.Level3) return true; if (p.AllianceRank == AllianceRank.Level1 && (allianceRank == AllianceRank.Level3 || allianceRank == AllianceRank.Level2)) return true; if (p.AllianceRank == AllianceRank.Level0 && (allianceRank == AllianceRank.Level3 || allianceRank == AllianceRank.Level2 || allianceRank == AllianceRank.Level1)) return true; return false; }
public override void Destroy() { if (Alliance != null) { vote = null; Alliance.Members.Remove(this); } List<DataObject> objects = new List<DataObject>(); foreach (Building b in Buildings) objects.Add(b); foreach (Unit u in Units) objects.Add(u); foreach (DataObject o in objects) o.Destroy(); List<Sector> sectors = new List<Sector>(); foreach (Sector s in Sectors) sectors.Add(s); foreach (Sector s in sectors) s.Owner = null; foreach (Player p in Game.GameData.Players.Values) if (p.Vote == this) p.Vote = p; Game.GameData.Players.Remove(this.Name); }
public bool CanAttack(Player p) { return p == null || (!IsProtected && !p.IsProtected && League != 0 && p.League == League && !IsAlly(p)); }