mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
refactor: removed outdated Player::assignDamage by multi amount dialog, fixed getMultiAmount to work with min values, added additional checks
This commit is contained in:
parent
86fc0028c1
commit
2d9ac4e732
12 changed files with 50 additions and 127 deletions
|
|
@ -390,38 +390,6 @@ public final class SimulatedPlayerMCTS extends MCTSPlayer {
|
|||
return super.chooseBlockerOrder(blockers, combatGroup, blockerOrder, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignDamage(int damage, List<UUID> targets, String singleTargetName, UUID attackerId, Ability source, Game game) {
|
||||
if (this.isHuman()) {
|
||||
int remainingDamage = damage;
|
||||
UUID targetId;
|
||||
int amount;
|
||||
while (remainingDamage > 0) {
|
||||
if (targets.size() == 1) {
|
||||
targetId = targets.get(0);
|
||||
amount = remainingDamage;
|
||||
} else {
|
||||
targetId = targets.get(RandomUtil.nextInt(targets.size()));
|
||||
amount = RandomUtil.nextInt(damage + 1);
|
||||
}
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.damage(amount, attackerId, source, game, false, true);
|
||||
remainingDamage -= amount;
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(amount, attackerId, source, game);
|
||||
remainingDamage -= amount;
|
||||
}
|
||||
}
|
||||
targets.remove(targetId);
|
||||
}
|
||||
} else {
|
||||
super.assignDamage(damage, targets, singleTargetName, attackerId, source, game);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(int min, int max, String message, Game game) {
|
||||
if (this.isHuman()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue