float calcBuffValue(THHGame game, THHPlayer player, THHPlayer opponent, Card target, int attack, int life) { float value = 0; if (target == player.master) { value = attack * target.getCurrentLife(game) + life; } else if (player.field.Contains(target)) { value = calcServantValue(game, player, opponent, target.getAttack(game) + attack, target.getCurrentLife(game) + life) - calcServantValue(game, player, opponent, target.getAttack(game), target.getLife(game)); } return(value); }
public void update(TouhouCardEngine.Card card, CardSkinData skin) { this.card = card; Image.sprite = skin.image; if (card.getAttack() > 0) { AttackText.text = card.getAttack().ToString(); AttackImage.gameObject.SetActive(true); } else { AttackImage.gameObject.SetActive(false); } DurabilityText.text = card.getCurrentLife().ToString(); }
float calcFreezeValue(THHGame game, THHPlayer player, THHPlayer opponent, Card target) { if (target == opponent.master || opponent.field.Contains(target)) { return(target.getAttack(game)); } return(0); }
public void update(Table table, THHPlayer player, TouhouCardEngine.Card card, CardSkinData skin) { this.card = card; Image.sprite = skin.image; HpText.text = card.getCurrentLife().ToString(); //if (card.getCurrentLife() == card.getLife()) // HpText.color = Color.white; //else // HpText.color = Color.red; if (card.getAttack() > 0) { AttackText.text = card.getAttack().ToString(); AttackText.enabled = true; } else { AttackText.enabled = false; } if (card.getArmor() > 0) { ArmorText.text = card.getArmor().ToString(); ArmorText.enabled = true; } else { ArmorText.enabled = false; } if (table.selectableTargets != null && table.selectableTargets.Contains(this)) { HighlightController = Highlight.Yellow; } else if (table.player == player && table.game.currentPlayer == player && card.canAttack(table.game, player)) { HighlightController = Highlight.Green; } else { HighlightController = Highlight.None; } }
float calcDamageValue(THHGame game, THHPlayer player, THHPlayer opponent, Card target, int damage) { float value = 0; if (target == opponent.master) { value = target.getCurrentLife(game) > damage ? damage : float.MaxValue; } else if (opponent.field.Contains(target)) { value = target.getCurrentLife(game) > damage?target.getAttack(game) * damage : target.getAttack(game) * target.getCurrentLife(game) + 1; } return(value); }
float calcServantValue(THHGame game, THHPlayer player, THHPlayer opponent, Card servant) { return(calcServantValue(game, player, opponent, servant.getAttack(game), servant.getCurrentLife(game))); }