Beispiel #1
0
		/// <summary>
		/// Helper function for setting up the lists of the different types of abilities that this card has
		/// </summary>
		/// <param name="activationType">When the ability is activated</param>
		/// <param name="ability">The ability to be activated</param>
		private void SetupAbilityTypeLists(BaseAbilityData.ActivationType activationType, CardGameAbility ability)
		{
			switch (activationType)
			{
				case BaseAbilityData.ActivationType.Active:
					// There should be no active abilities that aren't tied to attack anymore
					UnityEngine.Debug.LogError("Error: The data isn't correct, there shouldn't be active abilities here.");
					break;
				case BaseAbilityData.ActivationType.Battlecry:
					this.BattlecryAbilities.Add(ability);
					break;
				case BaseAbilityData.ActivationType.OnTurn:
					this.OnTurnAbilities.Add(ability);
					break;
				case BaseAbilityData.ActivationType.OnDeath:
					this.OnDeathAbilities.Add(ability);
					break;
			}
		}
Beispiel #2
0
        public Card(int cardId)
        {
			this._inPlay = false;

            this.CardId = cardId;
            this._cardData = DataStore.Instance.GetData<CardData>(cardId);

            this.CardName = this._cardData.Name;
            this.CardDescription = this._cardData.Description;
            this.CardAttackAbility = new CardGameAbility(this._cardData.AttackAbility);
			if (this.CardAttackAbility.AbilityActivate != BaseAbilityData.ActivationType.Active)
			{
				UnityEngine.Debug.LogError("Error: The submitted attack ability is not an active ability.");
			}
			this.CanUseAttack = true;

			this.CardBoardAbility = new CardBoardAbility(this._cardData.BoardAbility);
            this.CardHealth = this._cardData.Health;
            this._currentHealth = this._cardData.Health;

            // We assume that CooldownColorData and CooldownCountList are going to be the same size
            // The editor forces them to update in lock step with each other
            this.CardCooldownData = new List<CooldownData>();
            for (int i = 0; i < this._cardData.CooldownColorData.Count; ++i )
            {
                this.CardCooldownData.Add(new CooldownData(this._cardData.CooldownColorData[i], this._cardData.CooldownCountList[i]));
            }

            this._originalCooldownDataList = this.CardCooldownData.Select(d => new CooldownData(d.Color, d.Count)).ToList();

			this.SpritePortrait = this._cardData.Image; 
			this.SpriteTeam = this._cardData.ThumbImage;

            foreach (int gameAbilityId in this._cardData.GameAbilityList)
            {
				var abil = new CardGameAbility(gameAbilityId);
				this.SetupAbilityTypeLists(abil.AbilityActivate, abil);
            }

            foreach (int passiveAbilityId in this._cardData.PassiveAbilityList)
            {
                var abil = new CardPassiveAbility(passiveAbilityId);
                this.PassiveAbilities.Add(abil);
            }
        }