public void SetDefence() { hasPrimaryAttribute = true; SO_CardArmor card = cardDataBase.FindArmorCardByID(id); backgroundSR.sprite = card.image; primaryAttributeTitle.text = "DEFENCE"; primaryAttributeDescription.text = "The defence is the amount of damage the armor need to take before destroyed"; // Check if the weapon deals poison damage if (card.spickedBonus > 0) { firstSecondaryAttributeTitle.text = "SPIKED"; firstSecondaryAttributeDescription.text = "When you get attacked, the monster takes damage equel to your spiked"; hasFirstSecondaryAttribute = true; } // Check if the weapon deals Blunt damage if (card.brawl > 0) { if (hasFirstSecondaryAttribute) { secondSecondaryAttributeTitle.text = "BRAWL"; secondSecondaryAttributeDescription.text = "If you don't have a weapon equiped, you deal damage equel to your brawl"; hasSecondSecondaryAttribute = true; } firstSecondaryAttributeTitle.text = "BRAWL"; firstSecondaryAttributeDescription.text = "If you don't have a weapon equiped, you deal damage equel to your brawl"; hasFirstSecondaryAttribute = true; } }
void Start() { DiscardPile = GameObject.Find("DiscardPile"); endPointDiscardX = DiscardPile.transform.position.x; endPointDiscardY = DiscardPile.transform.position.y; if (id < 2000) { card = cardDataBase.FindArmorCardByID(id); } render.sprite = card.image; if (id != -10) { defence = card.armorBonus; } else { defence = battleManager.currentToughness; } defenceText.text = defence + ""; battleManager.currentSpiked += card.spickedBonus; battleManager.currentBrawl += card.brawl; battleManager.currentEquipmentArmor.Add(this.gameObject); // Add it to the array which holds all card objects placementInEquipent = battleManager.currentEquipmentArmor.Count; // Saves is place in the array Vector3 newPosition = new Vector3(0.8f + 0.8f * (placementInEquipent - 1), -1.5f, 0); // Just places it the right place this.transform.position = newPosition; }
public void PlayCard(int id) // Play a card { currentDiscard.Add(id); // if( discard > 0 ) make discard pile visable // make discard pile sprite be last discarded card //currentHand.RemoveAt(randomCard); if (id < 1000) // If the card is a melee card { SO_CardMelee card = cardDataBase.FindMeleeCardByID(id); Melee(id, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage); PrintLog("you just played " + card.name, "green"); } else if (id < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(id); Defence(id, card.armorBonus, card.spickedBonus); PrintLog("you just played " + card.name, "green"); } else if (id < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(id); PrintLog("you just played " + card.name, "green"); Utility(id); } else if (id < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(id); PrintLog("You got cursed by" + card.name, "red"); card.PlayedFunction(); } }
void Start() { cardDataBase = GameObject.FindObjectOfType <Sc_CardDataBase>(); battleManager = GameObject.FindObjectOfType <Sc_BattleManager>(); endPointDiscardX = GameObject.Find("DiscardPile").transform.position.x; endPointDiscardY = GameObject.Find("DiscardPile").transform.position.y; endPointY = -4.4f; Sc_BattleManager.currentHandObjects.Add(this.gameObject); // Add it to the array which holds all card objects placementInHand = Sc_BattleManager.currentHandObjects.Count; // Saves is place in the array // Vector3 newPosition = new Vector3 (1.1f * placementInHand, 2.2f, 0); // Just places it the right place // this.transform.position = newPosition; // Set the background of the card background = this.gameObject.transform.GetChild(0).gameObject; SpriteRenderer backgroundSR = background.GetComponent <SpriteRenderer>(); description = this.gameObject.transform.GetChild(1).gameObject; banner = this.gameObject.transform.GetChild(2).gameObject; leftIcon = this.gameObject.transform.GetChild(3).gameObject; rightIcon = this.gameObject.transform.GetChild(4).gameObject; leftBonusIconOne = this.gameObject.transform.GetChild(5).gameObject; leftBonusIconTwo = this.gameObject.transform.GetChild(6).gameObject; if (cardID < 1000) { SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetMeleeText(); } else if (cardID < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetArmorText(); } else if (cardID < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; SetUtilityText(); } else if (cardID < 4000) { CardCurse card = cardDataBase.FindCurseCardByID(cardID); apCost = card.apCost; backgroundSR.sprite = card.image; } // Get other components }
public void Load() { gameManager.isLoading = false; currentDeck = saveDataManager.saveData.currentDeckSave; currentDiscard = saveDataManager.saveData.currentDiscardSave; currentBanished = saveDataManager.saveData.currentBanishedSave; currentEffects = saveDataManager.saveData.currentEffectsSave; currentApUsed = saveDataManager.saveData.currentApUsedSave; currentUtilityAP = saveDataManager.saveData.currentUtilityAPSave; currentApMax = saveDataManager.saveData.currentApMaxSave; currentStage = 1; // Draw hand for (int i = 0; i < saveDataManager.saveData.currentHandObjectsSave.Count; i++) { Debug.Log(saveDataManager.saveData.currentHandObjectsSave[i]); GameObject newCard = (GameObject)Instantiate(card, new Vector3(2.50f, -3.1f, 3), Quaternion.Euler(0f, 180f, 90f)); Sc_Card newCardScript = newCard.GetComponent <Sc_Card>(); newCardScript.cardID = saveDataManager.saveData.currentHandObjectsSave[i]; } // Add saved armor cards into play for (int i = 0; i < saveDataManager.saveData.currentEquipmentArmorSave.Count; i++) { Debug.Log(saveDataManager.saveData.currentEquipmentArmorSave[i]); int idArmor = saveDataManager.saveData.currentEquipmentArmorSave[i]; Debug.Log(idArmor); if (idArmor < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(idArmor); Defence(idArmor, card.armorBonus, card.spickedBonus); PrintLog("you just played " + card.name, "green"); } } // Add saved melee cards into play for (int i = 0; i < saveDataManager.saveData.currentEquipmentMeleeSave.Count; i++) { Debug.Log(saveDataManager.saveData.currentEquipmentMeleeSave[i]); int idMelee = saveDataManager.saveData.currentEquipmentMeleeSave[i]; Debug.Log(idMelee); if (idMelee < 1000) // If the card is a melee card { SO_CardMelee card = cardDataBase.FindMeleeCardByID(idMelee); Melee(idMelee, card.normalDamage, card.bluntDamage, card.piercingDamage, card.poisonDamage); PrintLog("you just played " + card.name, "green"); } } // Draw hand for (int i = 0; i < gameManager.fullDeck.Count; i++) { currentDeck.Add(gameManager.fullDeck[i]); } }
public void CharmingGaze() { PlayingCard(5, charmingGazeDescription, charmingGazeName); battleManager.PrintLog("Placeholder used CharmingGaze", "red"); if (battleManager.currentDeck.Count <= 0) { if (battleManager.currentDiscard.Count <= 0) { return; } else { for (int i = 0; i < battleManager.currentDiscard.Count; i++) { battleManager.currentDeck.Add(battleManager.currentDiscard[i]); } battleManager.ShuffleDeck(); battleManager.currentDiscard.Clear(); } } int id = battleManager.currentDeck[0]; Sc_CardDataBase cardDataBase = GameObject.FindObjectOfType <Sc_CardDataBase>(); if (id < 1000) // If the card is a melee card { SO_CardMelee card = cardDataBase.FindMeleeCardByID(id); battleManager.PrintLog("Melee with the name " + card.name, "black"); damage = card.normalDamage; poison = card.poisonDamage; blunt = card.bluntDamage; piercing = card.piercingDamage; battleManager.DamageCalc(target: 0, damage: damage, poison: poison, blunt: blunt, piercing: piercing); } else if (id < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(id); battleManager.PrintLog("Armor with the name " + card.name, "black"); defence += card.armorBonus; UpdateText(); } else if (id < 3000) { battleManager.PrintLog("A Utility", "black"); } else if (id < 4000) { } }
public void SetArmorText() { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardID); // set description text GameObject descriptionText = description.gameObject.transform.GetChild(0).gameObject; TextMesh descriptionTextR = descriptionText.GetComponent <TextMesh>(); descriptionTextR.text = card.decription; // set banner and name text SpriteRenderer bannerSR = banner.GetComponent <SpriteRenderer>(); GameObject nameText = banner.gameObject.transform.GetChild(0).gameObject; TextMesh nameTextR = nameText.GetComponent <TextMesh>(); bannerSR.sprite = armorBanner; nameTextR.text = card.name; // Set the left Icon SpriteRenderer leftIconSR = leftIcon.GetComponent <SpriteRenderer>(); leftIconSR.sprite = armorIcon; GameObject leftIconText = leftIcon.gameObject.transform.GetChild(0).gameObject; TextMesh leftIconTextR = leftIconText.GetComponent <TextMesh>(); leftIconTextR.text = card.armorBonus + ""; // Set the Right Icon SpriteRenderer rightIconSR = rightIcon.GetComponent <SpriteRenderer>(); rightIconSR.sprite = costIcon; GameObject rightIconText = rightIcon.gameObject.transform.GetChild(0).gameObject; TextMesh rightIconTextR = rightIconText.GetComponent <TextMesh>(); rightIconTextR.text = card.apCost + ""; // Set the left bonus one icon if (card.spickedBonus > 0) { SpriteRenderer leftBonusIconOneR = leftBonusIconOne.GetComponent <SpriteRenderer>(); leftBonusIconOneR.sprite = yellowBanner; GameObject leftBonusIconOneText = leftBonusIconOne.gameObject.transform.GetChild(0).gameObject; TextMesh leftBonusIconOneTextR = leftBonusIconOneText.GetComponent <TextMesh>(); leftBonusIconOneTextR.text = card.spickedBonus + ""; } else { Destroy(leftBonusIconOne); } // Set the left bonus two icon Destroy(leftBonusIconTwo); }
// Update is called once per frame void Update() { if (battleManager.currentDiscard.Count != 0) { cardDiscardID = battleManager.currentDiscard[battleManager.currentDiscard.Count - 1]; } if (battleManager.currentBanished.Count != 0) { cardBanishID = battleManager.currentBanished[battleManager.currentBanished.Count - 1]; } if (DeckType == 1) { if (battleManager.currentDiscard.Capacity == 0) { //is card back display // Set the background of the card } if (battleManager.currentDiscard.Capacity > 0) { //is last card display if (cardDiscardID < 1000) { SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardDiscardID); SpriteRenderer2.sprite = card.image; } else if (cardDiscardID < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardDiscardID); SpriteRenderer2.sprite = card.image; } else if (cardDiscardID < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(cardDiscardID); SpriteRenderer2.sprite = card.image; } } } else if (DeckType == 2) { if (battleManager.currentBanished.Capacity == 0) { //is card back display } if (battleManager.currentBanished.Capacity > 0) { //is last card display if (cardBanishID < 1000) { SO_CardMelee card = cardDataBase.FindMeleeCardByID(cardBanishID); SpriteRenderer3.sprite = card.image; } else if (cardBanishID < 2000) { SO_CardArmor card = cardDataBase.FindArmorCardByID(cardBanishID); SpriteRenderer3.sprite = card.image; } else if (cardBanishID < 3000) { CardUtility card = cardDataBase.FindUtilityCardByID(cardBanishID); SpriteRenderer3.sprite = card.image; } } } }