double calculateScoreMinions(SabberStoneCore.Model.Zones.BoardZone before, SabberStoneCore.Model.Zones.BoardZone after) { foreach (Minion m in before.GetAll()) { debug("BEFORE " + stringMinion(m)); } foreach (Minion m in after.GetAll()) { debug("AFTER " + stringMinion(m)); } double scoreHealthReduced = 0; double scoreAttackReduced = 0; //We should add Divine shield removed? double scoreKilled = 0; double scoreAppeared = 0; //Minions modified? foreach (Minion mb in before.GetAll()) { bool survived = false; foreach (Minion ma in after.GetAll()) { if (ma.Id == mb.Id) { scoreHealthReduced = scoreHealthReduced + weights[MINION_HEALTH_REDUCED] * (mb.Health - ma.Health) * scoreMinion(mb); //Positive points if health is reduced scoreAttackReduced = scoreAttackReduced + weights[MINION_ATTACK_REDUCED] * (mb.AttackDamage - ma.AttackDamage) * scoreMinion(mb); //Positive points if attack is reduced survived = true; } } if (survived == false) { debug(stringMinion(mb) + " was killed"); scoreKilled = scoreKilled + scoreMinion(mb) * weights[MINION_KILLED]; //WHATEVER //Positive points if card is dead } } //New Minions on play? foreach (Minion ma in after.GetAll()) { bool existed = false; foreach (Minion mb in before.GetAll()) { if (ma.Id == mb.Id) { existed = true; } } if (existed == false) { debug(stringMinion(ma) + " is NEW!!"); scoreAppeared = scoreAppeared + scoreMinion(ma) * weights[MINION_APPEARED]; //Negative if a minion appeared (below) } } //Think always as positive points if the enemy suffers! return(scoreHealthReduced + scoreAttackReduced + scoreKilled - scoreAppeared); //CHANGE THESE SIGNS ACCORDINGLY!!! }
public double scoreMinions(SabberStoneCore.Model.Zones.BoardZone currentBoard, SabberStoneCore.Model.Zones.BoardZone nextBoard) { double scoreHealthReduced = 0; double scoreAttackReduced = 0; double scoreSilenced = 0; double scoreKilled = 0; double scoreSummoned = 0; //Add frozen, divine shield foreach (SabberStoneCore.Model.Entities.Minion currentMinion in currentBoard.GetAll()) { bool minionSurvived = false; foreach (SabberStoneCore.Model.Entities.Minion nextMinion in nextBoard.GetAll(minion => minion.Id == currentMinion.Id)) { scoreHealthReduced += weights[MINION_HEALTH_REDUCED] * (currentMinion.Health - nextMinion.Health) * scoreMinion(currentMinion); scoreAttackReduced += weights[MINION_ATTACK_REDUCED] * (currentMinion.AttackDamage - nextMinion.AttackDamage) * scoreMinion(currentMinion); scoreSilenced += !currentMinion.IsSilenced && nextMinion.IsSilenced ? weights[M_SILENCED] * scoreMinion(currentMinion) : 0; minionSurvived = true; } if (!minionSurvived) { scoreKilled += weights[MINION_KILLED] * scoreMinion(currentMinion); } } foreach (SabberStoneCore.Model.Entities.Minion minion in nextBoard.GetAll().Except(currentBoard.GetAll())) { scoreSummoned += weights[M_SUMMONED] * scoreMinion(minion); } return(scoreHealthReduced + scoreAttackReduced + scoreSilenced + scoreKilled - scoreSummoned); }
public BoardZone(SabberStoneCore.Model.Zones.BoardZone boardZone) { var minions = new RepeatedField <Minion>(); var span = boardZone.GetSpan(); for (int i = 0; i < span.Length; i++) { minions.Add(new Minion(span[i])); } minions_ = minions; }