public void OnUseCard_AfterApplyDmg(PFTable.Card useCard, APFCharacterController targetCtrl) { if (useCard != null) { if (useCard.statusKeepTurnCount > 0) { if (useCard.atkRate != 0) { CardEffect.PowerRate attackRate = Create_CardEffect_PowerRate(useCard.atkRate, useCard.statusKeepTurnCount); CardEffectList_AttackRate.Add(attackRate); } if (useCard.atkRateTarget != 0) { CardEffect.PowerRate attackRate = Create_CardEffect_PowerRate(useCard.atkRateTarget, useCard.statusKeepTurnCount); targetCtrl.CardEffectList_AttackRate.Add(attackRate); } if (useCard.defRate != 0) { CardEffect.PowerRate defenceRate = Create_CardEffect_PowerRate(useCard.defRate, useCard.statusKeepTurnCount); CardEffectList_DefenceRate.Add(defenceRate); } if (useCard.defRateTarget != 0) { CardEffect.PowerRate defenceRate = Create_CardEffect_PowerRate(useCard.defRateTarget, useCard.statusKeepTurnCount); targetCtrl.CardEffectList_DefenceRate.Add(defenceRate); } } } }
public static PFTable.Card GetRandomCard() { int randCardId = UnityEngine.Random.Range(PFConst.MonsterCardIdBegin, PFConst.MonsterCardIdEnd); PFTable.Card cardTable = PFTable.GetCard(randCardId); return(cardTable); }
public static PFTable.ECardApplyTarget GetApplyTarget(int cardId) { PFTable.Card cardTable = PFTable.GetCard(cardId); if (cardTable != null) { return(cardTable.applyTarget); } return(PFTable.ECardApplyTarget.Invalid); }
public static int GetCost(int cardTableId) { PFTable.Card cardTable = PFTable.GetCard(cardTableId); if (cardTable != null) { return(cardTable.cost); } return(PFNumber.InvalidCost); }
public static PFTable.ECardPoolType GetCardType(int cardId) { PFTable.Card cardTable = PFTable.GetCard(cardId); if (cardTable != null) { return(cardTable.cardPoolType); } return(PFTable.ECardPoolType.Invalid); }
public static List <APFCardUI> Create_DeckCards(GameObject cardParent, List <int> deckCardIdList, int bgFrameWidth) { APFCardUI card_original = Resources.Load <APFCardUI>(PFPrefabPath.Card); if (card_original == null) { StringBuilder sbLog = new StringBuilder(""); sbLog.AppendFormat("{0} 경로에 카드프리팹이 없습니다.", PFPrefabPath.Card); Debug.LogError(sbLog.ToString()); return(null); } int cardWidth = card_original.GetCardWidth(); int cardCount = deckCardIdList.Count; int cardTotalWidth = cardWidth * cardCount; float createPosX = (bgFrameWidth - cardTotalWidth) / 2; createPosX += cardWidth / 2; List <APFCardUI> newInstanceList = new List <APFCardUI>(cardCount); for (int i = 0; i < cardCount; ++i) { int cardId = deckCardIdList[i]; PFTable.Card cardTable = PFTable.GetCard(cardId); if (cardTable != null) { Vector3 createPos = new Vector3(createPosX, 0.0f, 0.0f); APFCardUI newCardInstance = PFUtil.Instantiate(card_original, cardParent, createPos); newCardInstance.Init(cardTable); newInstanceList.Add(newCardInstance); createPosX += cardWidth; } else { StringBuilder sbLog = new StringBuilder(""); sbLog.AppendFormat("카드테이블 id: {0} 카드정보가 없습니다", cardId); Debug.LogError(sbLog.ToString()); return(null); } } return(newInstanceList); }
private void Update_CardToUseForMyTurn() { CardToUseForMyTurn = PFMonsterStuff.GetRandomCard(); UnityEngine.Sprite skillImg_sprite = Resources.Load <UnityEngine.Sprite>(CardToUseForMyTurn.skillImgPath); PFMonsterCharacter.SkillImage.sprite2D = skillImg_sprite; int skillDamage = PFSkill.GetDamage(this, CardToUseForMyTurn.uid); string strSkillDamage = (skillDamage == 0) ? null : skillDamage.ToString(); PFMonsterCharacter.SkillDamage_UILabel.text = strSkillDamage; PFMonsterCharacter.SkillDetailInfo.SetActive(false); PFMonsterCharacter.SkillDetailInfo_UILabel.text = CardToUseForMyTurn.displayDesc; }
public void Init(PFTable.Card cardTable) { if (cardTable == null) { return; } CardTable = cardTable; UnityEngine.Sprite skillImg_sprite = Resources.Load <UnityEngine.Sprite>(CardTable.skillImgPath); SkillName.text = CardTable.displayName_KR; Description.text = CardTable.displayDesc; Cost.text = CardTable.cost.ToString(); SkillImage.sprite2D = skillImg_sprite; }
protected virtual void UseCard(PFTable.Card useCard, APFCharacter target_clickedChar) { if (useCard != null) { int cardCost = useCard.cost; AddCost(-cardCost); } if (PFCharacter != null) { PFCharacter.OnUseCard(useCard, target_clickedChar); } if (target_clickedChar != null) { UseCard_Dele(this, useCard, target_clickedChar.GetCharacterController()); } }
private List <APFCharacterController> GetTargetList(PFTable.Card srcCard, APFCharacterController specifiedTarget) { List <APFCharacterController> resultList = new List <APFCharacterController>(); PFTable.ECardApplyTarget applyTarget = PFCardTable.GetApplyTarget(srcCard.uid); if (applyTarget == PFTable.ECardApplyTarget.EnemyAll) { List <APFCharacter> aliveMonsterList = APFGameMode.GetInstance().GetAliveCharList(PFTable.CharacterType.Monster); for (int i = 0; i < aliveMonsterList.Count; ++i) { APFCharacterController monCtrl = aliveMonsterList[i].GetCharacterController(); resultList.Add(monCtrl); } } else { resultList.Add(specifiedTarget); } return(resultList); }
public virtual void OnUseCard(PFTable.Card card, APFCharacter target) { if (card != null) { if (card.shield > 0) { int newShieldVal = Shield + card.shield; SetShieldValue(newShieldVal); } if (card.statusIcon != PFTable.Card.StatusIcon.None) { APFStatusIconUI statusIcon = GetStatusIcon(card.statusIcon); if (statusIcon == null) { AddStatusIcon(card.statusIcon, card.statusKeepTurnCount); } else { int newStatusKeepTurnCount = statusIcon.GetStatusKeepTurnCount() + card.statusKeepTurnCount; statusIcon.SetStatusKeepTurnCount(newStatusKeepTurnCount); } } if (card.statusIcon_target != PFTable.Card.StatusIcon.None) { APFStatusIconUI statusIcon = target.GetStatusIcon(card.statusIcon_target); if (statusIcon == null) { target.AddStatusIcon(card.statusIcon_target, card.statusKeepTurnCount); } else { int newStatusKeepTurnCount = statusIcon.GetStatusKeepTurnCount() + card.statusKeepTurnCount; statusIcon.SetStatusKeepTurnCount(newStatusKeepTurnCount); } } } }
public static int GetDamage(APFCharacterController attackerCharCtrl, int cardTableId) { if (attackerCharCtrl != null) { int characterTableId = attackerCharCtrl.CharacterTableId; PFTable.Character charTable = PFTable.GetCharacter(characterTableId); PFTable.Card cardTable = PFTable.GetCard(cardTableId); if (charTable != null && cardTable != null) { float atkRateSum = attackerCharCtrl.GetCardEffectSum(ECardEffect.AtkRate); float atkRatio = charTable.atkRatio + atkRateSum; float fDamage = atkRatio * cardTable.damage; int iDamage = (int)fDamage;//소수점이 발생하면 버린다. return(iDamage); } } return(0); }
public override void OnUseCard(PFTable.Card card, APFCharacter target) { base.OnUseCard(card, target); }
private void OnUseCard(APFCharacterController srcCharCtrl, PFTable.Card srcCard, APFCharacterController target_clickedChar) { if (srcCharCtrl != null && srcCard != null) { EGameResult gameResult = EGameResult.InProgress; PFTable.ECardActiveType cardActiveType = PFCardTable.GetCardActiveType(srcCard.uid); //if (cardActiveType == PFTable.ECardActiveType.Instant) { List <APFCharacterController> targetList = GetTargetList(srcCard, target_clickedChar); int damage = PFSkill.GetDamage(srcCharCtrl, srcCard.uid); for (int i = 0; i < targetList.Count; ++i) { targetList[i].OnBeAttacked(damage); srcCharCtrl.OnUseCard_AfterApplyDmg(srcCard, targetList[i]); if (targetList[i].GetHP() <= PFConst.HP_Min) { gameResult = OnCharacterDead(targetList[i]); } } } int[] cardEffectIdList = srcCard.CardEffectIdList; if (cardEffectIdList != null) { for (int i = 0; i < cardEffectIdList.Length; ++i) { //PFTable.CardEffect.EType cardEffectType = PFCardEffectTable.GetCardEffectType(cardEffectIdList[i]); //if (cardEffectType == PFTable.CardEffect.EType.DecreaseHP) //{ //} int effectId = cardEffectIdList[i]; PFTable.Damage effect_Damage = PFTable.GetEffect_Damage(effectId); if (effect_Damage != null) { if (effect_Damage.ActuationTiming == PFTable.EActuationTiming.Instant) { DoDamage(srcCharCtrl, effectId, target_clickedChar); //StartCoroutine(DoDamage(srcCharCtrl, effectId, target_clickedChar)); /* * if (targetList[j].GetHP() <= PFConst.HP_Min) * { * gameResult = OnCharacterDead(targetList[j]); * } */ } else { srcCharCtrl.PendingEffect_DamageList.Add(effectId); } } PFTable.AddAtkRate addAtkRate = PFTable.GetAddAtkRate(effectId); if (addAtkRate != null) { //addAtkRate.Amount //addAtkRate.TargetType if (addAtkRate.ActuationTiming == PFTable.EActuationTiming.Instant) { } } PFTable.CardEffect cardEffect = PFTable.GetCardEffect(effectId); if (cardEffect != null) { if (cardEffect.CardEffectType == PFTable.CardEffect.EType.DecreaseHP) { //cardEffect.Amount } } } } if (gameResult == EGameResult.InProgress) { PFTable.CharacterType srcCharType = PFCharacterTable.GetCharacterType(srcCharCtrl.CharacterTableId); if (srcCharType == PFTable.CharacterType.Monster) { int remainCost = srcCharCtrl.GetCost(); if (remainCost <= 0) { TurnEnd(srcCharCtrl); } } } else if (gameResult == EGameResult.Victory) { GameOverUI.Title_UILabel.text = PFConst.StrGameResultVictory; GameOverUI.gameObject.SetActive(true); } else if (gameResult == EGameResult.Defeat) { GameOverUI.Title_UILabel.text = PFConst.StrGameResultDefeat; GameOverUI.gameObject.SetActive(true); } } }