mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
PlayerImpl fix
This commit is contained in:
parent
76537b0c66
commit
4b2a9cd203
8 changed files with 53 additions and 35 deletions
|
@ -61,12 +61,16 @@ public class GameStateEvaluator2 {
|
|||
}
|
||||
|
||||
int permanentScore = 0;
|
||||
try {
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||
permanentScore += evaluatePermanent(permanent, game);
|
||||
}
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(opponent.getId())) {
|
||||
permanentScore -= evaluatePermanent(permanent, game);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
//permanentScore *= PERMANENT_FACTOR;
|
||||
|
||||
/*int handScore = 0;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ArtificialScoringSystem {
|
|||
private static final int LIFE_ABOVE_MULTIPLIER = 100;
|
||||
|
||||
public static int getCardDefinitionScore(final Game game, final Card card) {
|
||||
int value = 0; //TODO: add new rating system card value
|
||||
int value = 3; //TODO: add new rating system card value
|
||||
if (card.getCardType().contains(Constants.CardType.LAND)) {
|
||||
int score = (int) ((value / 2.0f) * 50);
|
||||
//TODO: check this for "any color" lands
|
||||
|
|
|
@ -15,35 +15,36 @@ import java.util.zip.Inflater;
|
|||
public class MagicAbility {
|
||||
|
||||
private static Map<String, Integer> scores = new HashMap<String, Integer>() {{
|
||||
scores.put(DeathtouchAbility.getInstance().getRule(), 60);
|
||||
scores.put(DefenderAbility.getInstance().getRule(), -100);
|
||||
scores.put(DoubleStrikeAbility.getInstance().getRule(), 100);
|
||||
scores.put(DoubleStrikeAbility.getInstance().getRule(), 100);
|
||||
scores.put(new ExaltedAbility().getRule(), 10);
|
||||
scores.put(FirstStrikeAbility.getInstance().getRule(), 50);
|
||||
scores.put(FlashAbility.getInstance().getRule(), 0);
|
||||
scores.put(FlyingAbility.getInstance().getRule(), 50);
|
||||
scores.put(new ForestwalkAbility().getRule(), 10);
|
||||
scores.put(HasteAbility.getInstance().getRule(), 0);
|
||||
scores.put(IndestructibleAbility.getInstance().getRule(), 150);
|
||||
scores.put(InfectAbility.getInstance().getRule(), 60);
|
||||
scores.put(IntimidateAbility.getInstance().getRule(), 50);
|
||||
scores.put(new IslandwalkAbility().getRule(), 10);
|
||||
scores.put(new MountainwalkAbility().getRule(), 10);
|
||||
scores.put(new PlainswalkAbility().getRule(), 10);
|
||||
scores.put(ReachAbility.getInstance().getRule(), 20);
|
||||
scores.put(ShroudAbility.getInstance().getRule(), 60);
|
||||
scores.put(new SwampwalkAbility().getRule(), 10);
|
||||
scores.put(TrampleAbility.getInstance().getRule(), 30);
|
||||
scores.put(UnblockableAbility.getInstance().getRule(), 100);
|
||||
scores.put(VigilanceAbility.getInstance().getRule(), 20);
|
||||
scores.put(WitherAbility.getInstance().getRule(), 30);
|
||||
put(DeathtouchAbility.getInstance().getRule(), 60);
|
||||
put(DefenderAbility.getInstance().getRule(), -100);
|
||||
put(DoubleStrikeAbility.getInstance().getRule(), 100);
|
||||
put(DoubleStrikeAbility.getInstance().getRule(), 100);
|
||||
put(new ExaltedAbility().getRule(), 10);
|
||||
put(FirstStrikeAbility.getInstance().getRule(), 50);
|
||||
put(FlashAbility.getInstance().getRule(), 0);
|
||||
put(FlyingAbility.getInstance().getRule(), 50);
|
||||
put(new ForestwalkAbility().getRule(), 10);
|
||||
put(HasteAbility.getInstance().getRule(), 0);
|
||||
put(IndestructibleAbility.getInstance().getRule(), 150);
|
||||
put(InfectAbility.getInstance().getRule(), 60);
|
||||
put(IntimidateAbility.getInstance().getRule(), 50);
|
||||
put(new IslandwalkAbility().getRule(), 10);
|
||||
put(new MountainwalkAbility().getRule(), 10);
|
||||
put(new PlainswalkAbility().getRule(), 10);
|
||||
put(ReachAbility.getInstance().getRule(), 20);
|
||||
put(ShroudAbility.getInstance().getRule(), 60);
|
||||
put(new SwampwalkAbility().getRule(), 10);
|
||||
put(TrampleAbility.getInstance().getRule(), 30);
|
||||
put(UnblockableAbility.getInstance().getRule(), 100);
|
||||
put(VigilanceAbility.getInstance().getRule(), 20);
|
||||
put(WitherAbility.getInstance().getRule(), 30);
|
||||
}};
|
||||
|
||||
public static int getAbilityScore(Ability ability) {
|
||||
if (!scores.containsKey(ability.getRule())) {
|
||||
System.err.println("Couldn't find ability score: " + ability.getRule());
|
||||
//System.err.println("Couldn't find ability score: " + ability.getRule());
|
||||
//TODO: add handling protection from ..., levelup, kicker, etc. abilities
|
||||
return 0;
|
||||
}
|
||||
return scores.get(ability.getRule());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Sun Feb 06 08:07:38 EST 2011
|
||||
#Sat Feb 12 11:24:53 MSK 2011
|
||||
version=0.6
|
||||
groupId=org.mage
|
||||
artifactId=Mage-Tournament-BoosterDraft
|
||||
|
|
Binary file not shown.
|
@ -32,7 +32,7 @@ public class PlayGameTest extends MageTestBase {
|
|||
game.loadCards(deck.getCards(), player.getId());
|
||||
|
||||
Player player2 = createPlayer("computer2", "Computer - mad");
|
||||
Deck deck2 = Deck.load(Sets.loadDeck("UW Control.dck"));
|
||||
Deck deck2 = Deck.load(Sets.loadDeck("RB Aggro.dck"));
|
||||
if (deck2.getCards().size() < 40) {
|
||||
throw new IllegalArgumentException("Couldn't load deck, deck side=" + deck2.getCards().size());
|
||||
}
|
||||
|
|
|
@ -33,10 +33,13 @@ import mage.Constants.Layer;
|
|||
import mage.Constants.Outcome;
|
||||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -50,6 +53,7 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
|
|||
|
||||
public BoostPowerXSourceEffect(final BoostPowerXSourceEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,8 +63,15 @@ public class BoostPowerXSourceEffect extends ContinuousEffectImpl<BoostPowerXSou
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (amount < 0)
|
||||
amount = source.getCosts().getVariableCosts().get(0).getAmount();
|
||||
if (amount < 0) {
|
||||
List<VariableCost> varCost = source.getCosts().getVariableCosts();
|
||||
if (varCost.size() > 0) {
|
||||
amount = varCost.get(0).getAmount();
|
||||
} else {
|
||||
amount = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Permanent target = (Permanent) game.getPermanent(source.getSourceId());
|
||||
if (target != null) {
|
||||
target.addPower(amount);
|
||||
|
|
|
@ -962,7 +962,9 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
for (UUID targetId: option.getTargets().getUnchosen().get(targetNum).possibleTargets(option.getSourceId(), playerId, game)) {
|
||||
Ability newOption = option.copy();
|
||||
newOption.getTargets().get(targetNum).addTarget(targetId, option, game);
|
||||
if (targetNum < option.getTargets().size() - 1) {
|
||||
if (targetNum < option.getTargets().size() - 2) {
|
||||
//addTargetOptions(options, newOption, targetNum + 1, game);
|
||||
// ayrat: bug fix
|
||||
addTargetOptions(options, newOption, targetNum + 1, game);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue