public BoardObj(CardDB.cardName cName, int lvl = 0) { CardDB.Card c = CardDB.Instance.getCardDataFromName(cName, lvl); this.card = c; this.Name = c.name; this.type = c.type; this.Transport = c.Transport; this.affectOn = c.affectType; this.cost = c.cost; this.DeployTime = c.DeployTime; this.DamageRadius = c.DamageRadius; this.MaxHP = c.MaxHP; this.HP = c.MaxHP; this.Atk = c.Atk; this.Shield = c.Shield; this.Speed = c.Speed; this.HitSpeed = c.HitSpeed; this.MinRange = c.MinRange; this.Range = c.MaxRange; this.SightRange = c.SightRange; this.TargetType = c.TargetType; this.MaxTargets = c.MultipleTargets; this.LifeTime = c.LifeTime; this.SpawnNumber = c.SpawnNumber; this.SpawnInterval = c.SpawnInterval; this.SpawnTime = c.SpawnPause; this.SpawnCharacterLevel = c.SpawnCharacterLevel; this.DeathEffect = c.DeathEffect; this.level = lvl; //this.Tower = c.Tower; }
public List <Handcard> getCardsByType(boardObjType type) { List <Handcard> retval = new List <Handcard>(); int count = ownHandCards.Count; Handcard hc; for (int i = 0; i < count; i++) { hc = ownHandCards[i]; if (hc.card.type == type) { retval.Add(hc); } } return(retval); }
public BoardObj(BoardObj bo) { this.Name = bo.Name; this.card = bo.card; this.type = bo.type; this.Transport = bo.Transport; this.affectOn = bo.affectOn; this.Position = bo.Position; this.own = bo.own; this.pID = bo.pID; //-???????? this.Line = bo.Line; this.GId = bo.GId; this.cost = bo.cost; this.DeployTime = bo.DeployTime; this.DamageRadius = bo.DamageRadius; this.MaxHP = bo.MaxHP; this.HP = bo.HP; this.Atk = bo.Atk; this.Shield = bo.Shield; this.Speed = bo.Speed; this.HitSpeed = bo.HitSpeed; this.MinRange = bo.MinRange; this.Range = bo.Range; this.SightRange = bo.SightRange; this.TargetType = bo.TargetType; this.MaxTargets = bo.MaxTargets; this.attacking = bo.attacking; this.attacked = bo.attacked; this.LifeTime = bo.LifeTime; this.SpawnNumber = bo.SpawnNumber; this.SpawnInterval = bo.SpawnInterval; this.SpawnTime = bo.SpawnTime; this.SpawnCharacterLevel = bo.SpawnCharacterLevel; this.frozen = bo.frozen; this.clone = bo.clone; this.startFrozen = bo.startFrozen; this.attacker = bo.attacker; this.target = bo.target; this.DeathEffect = bo.DeathEffect; this.Tower = bo.Tower; this.extraData = bo.extraData; }
public BoardObj(CardDB.cardName cName, int lvl = 0) { CardDB.Card c = CardDB.Instance.getCardDataFromName(cName, lvl); this.card = c; this.Name = c.name; this.type = c.type; this.Transport = c.Transport; this.affectOn = c.affectType; //this.Position = c.Position; //this.own = c.own; //this.pID = c.pID; //-???????? //this.Line = c.Line; //this.GId = c.GId; this.cost = c.cost; this.DeployTime = c.DeployTime; this.DamageRadius = c.DamageRadius; this.MaxHP = c.MaxHP; this.HP = c.MaxHP; this.Atk = c.Atk; this.Shield = c.Shield; this.Speed = c.Speed; this.HitSpeed = c.HitSpeed; this.MinRange = c.MinRange; this.Range = c.MaxRange; this.SightRange = c.SightRange; this.TargetType = c.TargetType; this.MaxTargets = c.MultipleTargets; //this.attacking = c.attacking; //this.attacked = c.attacked; this.LifeTime = c.LifeTime; this.SpawnNumber = c.SpawnNumber; this.SpawnInterval = c.SpawnInterval; this.SpawnTime = c.SpawnPause; this.SpawnCharacterLevel = c.SpawnCharacterLevel; //this.frozen = c.frozen; //this.startFrozen = c.startFrozen; //this.attacker = c.attacker; //this.target = c.target; this.DeathEffect = c.DeathEffect; //this.Tower = c.Tower; }
public Handcard getCheapestCard(boardObjType type, targetType tgtType) { Handcard retval = null; List <Handcard> tmp = new List <Handcard>(); foreach (Handcard hc in ownHandCards) { if ((hc.card.type == type || type == boardObjType.NONE) && (hc.card.TargetType == targetType.NONE || hc.card.TargetType == tgtType)) { tmp.Add(hc); } } foreach (Handcard hc in tmp) { if (retval == null || hc.card.cost < retval.card.cost) { retval = hc; } } return(retval); }
public static bool IsAnEnemyObjectInArea(Playfield p, VectorAI position, int areaSize, boardObjType type) { bool WhereClause(BoardObj n) => n.Position.X >= position.X - areaSize && n.Position.X <= position.X + areaSize && n.Position.Y >= position.Y - areaSize && n.Position.Y <= position.Y + areaSize; if (type == boardObjType.MOB) { return(p.enemyMinions.Where(WhereClause).Any()); } else if (type == boardObjType.BUILDING) { return(p.enemyBuildings.Where(WhereClause).Any()); } else if (type == boardObjType.AOE) { return(p.enemyAreaEffects.Where(WhereClause).Any()); } return(false); }
public static IEnumerable <Handcard> GetOwnHandCards(Playfield p, boardObjType cardType, SpecificCardType sCardType, MoreSpecificMobCardType msCardType = MoreSpecificMobCardType.None) { var cardsOfType = p.ownHandCards.Where(n => n.card.type == cardType).ToArray(); if (cardsOfType.Length == 0) { return(cardsOfType); } Func <Handcard, bool> @delegate = (n) => true; Func <Handcard, bool> @msDelegate = (n) => true; switch (sCardType) { case SpecificCardType.All: break; // Mobs case SpecificCardType.MobsTank: @delegate = IsMobsTank; break; case SpecificCardType.MobsRanger: @delegate = IsMobsRanger; break; case SpecificCardType.MobsBigGroup: @delegate = IsMobsBigGroup; break; case SpecificCardType.MobsDamageDealer: @delegate = IsMobsDamageDealer; break; case SpecificCardType.MobsBuildingAttacker: @delegate = IsMobsBuildingAttacker; break; case SpecificCardType.MobsFlyingAttack: @delegate = IsMobsFlyingAttack; break; // Buildings case SpecificCardType.BuildingsDefense: @delegate = IsBuildingsDefense; // TODO: Define break; case SpecificCardType.BuildingsAttack: @delegate = IsBuildingsAttack; // TODO: Define break; case SpecificCardType.BuildingsSpawning: @delegate = IsBuildingsSpawning; break; case SpecificCardType.BuildingsMana: @delegate = (n) => false; break; // TODO: ManaProduction // Spells case SpecificCardType.SpellsDamaging: @delegate = IsSpellsDamaging; break; case SpecificCardType.SpellsNonDamaging: @delegate = IsSpellsNonDamaging; break; case SpecificCardType.SpellsTroopSpawning: @delegate = IsSpellsTroopSpawning; // TODO: Check break; case SpecificCardType.SpellsBuffs: @delegate = IsSpellBuff; // TODO: Check break; default: @delegate = (n) => false; break; } switch (msCardType) { case MoreSpecificMobCardType.None: break; case MoreSpecificMobCardType.ShortDistance: @msDelegate = IsShortDistance; break; case MoreSpecificMobCardType.LongDistance: @msDelegate = IsLongDistance; break; case MoreSpecificMobCardType.BuildingAttacker: @msDelegate = IsBuildingsAttack; break; case MoreSpecificMobCardType.AOEGround: @msDelegate = IsAOEGround; break; case MoreSpecificMobCardType.AOEAll: @msDelegate = IsAOEAll; break; case MoreSpecificMobCardType.FlyingAttack: @msDelegate = IsMobsFlyingAttack; break; case MoreSpecificMobCardType.Flying: @msDelegate = IsFlying; break; case MoreSpecificMobCardType.NotFlying: @msDelegate = IsNotFlying; break; case MoreSpecificMobCardType.DamageDealer: @msDelegate = IsMobsDamageDealer; break; case MoreSpecificMobCardType.NoBigGroup: @msDelegate = IsNoBigGroup; break; } if (@msDelegate == null) { return(cardsOfType.Where(@delegate).ToArray()); } else { return(cardsOfType.Where(@delegate).Where(msDelegate).ToArray()); } }