void Update() { if (initialized) { enemyHealthBar.updateHealthBar(enemy.data.healthBarData); if (enemy.data.healthBarData.currHealth <= 0) { gameObject.SetActive(false); EnemyManagerService.getInstance().onEnemyDefeat(this); } if (attacking) { this.attackAnimationAction(); } Card enemyTurn = enemy.data.enemyTurnData.currEnemyTurn; if (enemyTurn != null) { double weakModifier = StatusUtils.getAppliedStatusCount(StatusTypes.StatusEnum.weak, this.statusesObject.activeStatuses) > 0 ? enemy.data.weakMultiplier : 1.0; enemyBlockIntent.text = "Block: " + enemyTurn.data.defend.ToString(); enemyAttackIntent.text = "Attack: " + ((int)(weakModifier * enemyTurn.data.attack)).ToString(); if (enemyTurn.data.attackMultiplier > 1) { enemyAttackIntent.text += " x " + enemyTurn.data.attackMultiplier.ToString(); } otherIntent.text = ""; if (enemyTurn.data.cardToAddToPlayersDecks != null && enemyTurn.data.cardToAddToPlayersDecks.Count > 0) { otherIntent.text = "Add " + enemyTurn.data.cardToAddToPlayersDecks.Count + " cards to players deck"; } } } }
public Card getModifiedEnemyTurn(EnemyGameObject enemyGameObject) { Card modifiedEnemyTurn = stackCardAffects(enemyGameObject.enemy.data.enemyTurnData.enemyModifiers); if (StatusUtils.getAppliedStatusCount(StatusTypes.StatusEnum.weak, enemyGameObject.statusesObject.activeStatuses) > 0) { modifiedEnemyTurn.data.attack = (int)(modifiedEnemyTurn.data.attack * enemyGameObject.enemy.data.weakMultiplier); } return(modifiedEnemyTurn); }
public int getDamageAmount(Card card) { EnemyData enemyData = null; if (card.data.targetedEnemy != null) { enemyData = card.data.targetedEnemy.enemy.data; } PlayerData playerData = GameData.getInstance().playerGameObject.playerData; int baseDamage = card.data.attack + card.data.temporaryDmgBoost; double targetModifier = (enemyData != null && StatusUtils.getAppliedStatusCount( StatusTypes.StatusEnum.vulnerable, card.data.targetedEnemy.statusesObject.activeStatuses ) > 0) ? enemyData.vulnerableMultiplier : 1; int playerStrength = playerData != null ? playerData.strength : 0; int attackBonusDamage = playerData != null ? playerData.nextAttackBonusDamage : 0; return((int)((baseDamage + playerStrength + attackBonusDamage) * targetModifier)); }
public void takeHit(EnemyGameObject enemyGameObject, int damage, int attackMultiplier) { if (damage <= 0) { return; } for (int i = 0; i < attackMultiplier; i++) { int modifiedDamage = damage + GameData.getInstance().playerGameObject.playerData.nextAttackBonusDamage; if (StatusUtils.getAppliedStatusCount(StatusTypes.StatusEnum.vulnerable, enemyGameObject.statusesObject.activeStatuses) > 0) { modifiedDamage = (int)(modifiedDamage * enemyGameObject.enemy.data.vulnerableMultiplier); } if (enemyGameObject.enemy.data.healthBarData.currBlock >= modifiedDamage) { enemyGameObject.enemy.data.healthBarData.currBlock -= modifiedDamage; } else { enemyGameObject.enemy.data.healthBarData.currHealth -= modifiedDamage - enemyGameObject.enemy.data.healthBarData.currBlock; enemyGameObject.enemy.data.healthBarData.currBlock = 0; } } }