mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Avoid double look up in map.
This commit is contained in:
@@ -116,10 +116,11 @@ public final class AbilityFactory {
|
|||||||
public static Cost parseAbilityCost(final Card hostCard, Map<String, String> mapParams, AbilityRecordType type) {
|
public static Cost parseAbilityCost(final Card hostCard, Map<String, String> mapParams, AbilityRecordType type) {
|
||||||
Cost abCost = null;
|
Cost abCost = null;
|
||||||
if (type != AbilityRecordType.SubAbility) {
|
if (type != AbilityRecordType.SubAbility) {
|
||||||
if (!mapParams.containsKey("Cost")) {
|
String cost = mapParams.get("Cost");
|
||||||
|
if (cost == null) {
|
||||||
throw new RuntimeException("AbilityFactory : getAbility -- no Cost in " + hostCard.getName());
|
throw new RuntimeException("AbilityFactory : getAbility -- no Cost in " + hostCard.getName());
|
||||||
}
|
}
|
||||||
abCost = new Cost(mapParams.get("Cost"), type == AbilityRecordType.Ability);
|
abCost = new Cost(cost, type == AbilityRecordType.Ability);
|
||||||
}
|
}
|
||||||
return abCost;
|
return abCost;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user