Example #1
0
        public SimTemplate GetSimCard(cardIDEnum tempCardIdEnum)
        {
            SimTemplate result = new SimTemplate();

            var  className = $"HREngine.Bots.Sim_{tempCardIdEnum}";
            Type type      = Type.GetType(className);

            if (type == null)
            {
                //write a log here
            }
            else
            {
                var simTemplateInstance = Activator.CreateInstance(type);
                if (simTemplateInstance is SimTemplate temp)
                {
                    result = temp;
                }
                else
                {
                    throw new Exception($"class {className} should inherit from {typeof(SimTemplate)}");
                }
            }
            if (tempCardIdEnum == cardIDEnum.GIL_530)
            {
                Logger.GetLoggerInstanceForType().InfoFormat($"className = {className}, type of result is {type}");
            }
            return(result);
        }
Example #2
0
 public Card(Card c)
 {
     //this.entityID = c.entityID;
     this.hasEffect = c.hasEffect;
     this.rarity = c.rarity;
     this.AdjacentBuff = c.AdjacentBuff;
     this.Attack = c.Attack;
     this.Aura = c.Aura;
     this.battlecry = c.battlecry;
     this.carddraw = c.carddraw;
     //this.CardID = c.CardID;
     this.Charge = c.Charge;
     this.choice = c.choice;
     this.Combo = c.Combo;
     this.cost = c.cost;
     this.deathrattle = c.deathrattle;
     //this.description = c.description;
     this.Durability = c.Durability;
     this.Elite = c.Elite;
     this.Enrage = c.Enrage;
     this.Freeze = c.Freeze;
     this.GrantCharge = c.GrantCharge;
     this.HealTarget = c.HealTarget;
     this.Health = c.Health;
     this.immuneToSpellpowerg = c.immuneToSpellpowerg;
     this.immuneWhileAttacking = c.immuneWhileAttacking;
     this.Morph = c.Morph;
     this.name = c.name;
     this.needEmptyPlacesForPlaying = c.needEmptyPlacesForPlaying;
     this.needMinionsCapIfAvailable = c.needMinionsCapIfAvailable;
     this.needMinNumberOfEnemy = c.needMinNumberOfEnemy;
     this.needMinTotalMinions = c.needMinTotalMinions;
     this.needRaceForPlaying = c.needRaceForPlaying;
     this.needWithMaxAttackValueOf = c.needWithMaxAttackValueOf;
     this.needWithMinAttackValueOf = c.needWithMinAttackValueOf;
     this.oneTurnEffect = c.oneTurnEffect;
     this.playrequires = new List<ErrorType2>(c.playrequires);
     this.poisionous = c.poisionous;
     this.race = c.race;
     this.Recall = c.Recall;
     this.recallValue = c.recallValue;
     this.Secret = c.Secret;
     this.Shield = c.Shield;
     this.Silence = c.Silence;
     this.Spellpower = c.Spellpower;
     this.spellpowervalue = c.spellpowervalue;
     this.Stealth = c.Stealth;
     this.tank = c.tank;
     this.target = c.target;
     //this.targettext = c.targettext;
     this.type = c.type;
     this.windfury = c.windfury;
     this.cardIDenum = c.cardIDenum;
     this.sim_card = c.sim_card;
 }
Example #3
0
 public Card(HRSim.CardDB.Card c)
 {
     this.playrequires = new List<ErrorType2>();
     //this.entityID = c.entityID;
     this.rarity = c.rarity;
     this.AdjacentBuff = c.AdjacentBuff;
     this.Attack = c.Attack;
     this.Aura = c.Aura;
     this.battlecry = c.battlecry;
     //this.CardID = c.CardID;
     this.Charge = c.Charge;
     this.choice = c.choice;
     this.Combo = c.Combo;
     this.cost = c.cost;
     this.deathrattle = c.deathrattle;
     //this.description = c.description;
     this.Durability = c.Durability;
     this.Elite = c.Elite;
     this.Enrage = c.Enrage;
     this.Freeze = c.Freeze;
     this.GrantCharge = c.GrantCharge;
     this.HealTarget = c.HealTarget;
     this.Health = c.Health;
     this.immuneToSpellpowerg = c.immuneToSpellpowerg;
     this.immuneWhileAttacking = c.immuneWhileAttacking;
     this.Morph = c.Morph;
     this.name = (cardName)Enum.Parse(typeof(cardName), c.name.ToString());
     this.needEmptyPlacesForPlaying = c.needEmptyPlacesForPlaying;
     this.needMinionsCapIfAvailable = c.needMinionsCapIfAvailable;
     this.needMinNumberOfEnemy = c.needMinNumberOfEnemy;
     this.needMinTotalMinions = c.needMinTotalMinions;
     this.needRaceForPlaying = c.needRaceForPlaying;
     this.needWithMaxAttackValueOf = c.needWithMaxAttackValueOf;
     this.needWithMinAttackValueOf = c.needWithMinAttackValueOf;
     this.oneTurnEffect = c.oneTurnEffect;
     foreach (HRSim.CardDB.ErrorType2 e in c.playrequires) {
         ErrorType2 mError = (ErrorType2)Enum.Parse(typeof(ErrorType2), e.ToString());
         this.playrequires.Add(mError);
     }
     this.poisionous = c.poisionous;
     this.race = c.race;
     this.Recall = c.Recall;
     this.recallValue = c.recallValue;
     this.Secret = c.Secret;
     this.Shield = c.Shield;
     this.Silence = c.Silence;
     this.Spellpower = c.Spellpower;
     this.spellpowervalue = c.spellpowervalue;
     this.Stealth = c.Stealth;
     this.tank = c.tank;
     this.target = c.target;
     //this.targettext = c.targettext;
     this.type = (cardtype)Enum.Parse(typeof(cardtype), c.type.ToString());
     this.windfury = c.windfury;
     this.cardIDenum = (cardIDEnum)Enum.Parse(typeof(cardIDEnum), c.cardIDenum.ToString());
     this.sim_card = instance.getSimCard(this.cardIDenum);
     this.isToken = c.isToken;
 }