mirror of https://github.com/FreeCol/freecol.git
Add identifiers to PlunderType now that it is a FCSOT.
This commit is contained in:
parent
211e150555
commit
eca4896e87
|
@ -2963,11 +2963,13 @@
|
|||
minimum-size="4" maximum-size="6"
|
||||
minimum-growth="1" maximum-growth="8"
|
||||
trade-bonus="1" convert-threshold="100">
|
||||
<plunder probability="20" minimum="2" maximum="3" factor="100">
|
||||
<plunder id="plunder.camp" probability="20"
|
||||
minimum="2" maximum="3" factor="100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="3" maximum="6" factor="100">
|
||||
<plunder id="plunder.camp.extra" probability="100"
|
||||
minimum="3" maximum="6" factor="100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -2980,11 +2982,13 @@
|
|||
minimum-size="6" maximum-size="8"
|
||||
minimum-growth="2" maximum-growth="10"
|
||||
trade-bonus="2" convert-threshold="100">
|
||||
<plunder probability="100" minimum="2" maximum="4" factor="200">
|
||||
<plunder id="plunder.camp.capital" probability="100"
|
||||
minimum="2" maximum="4" factor="200">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="2" maximum="4" factor="300">
|
||||
<plunder id="plunder.camp.capital.extra" probability="100"
|
||||
minimum="2" maximum="4" factor="300">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -2999,11 +3003,13 @@
|
|||
minimum-size="6" maximum-size="8"
|
||||
minimum-growth="1" maximum-growth="8"
|
||||
trade-bonus="2" convert-threshold="100">
|
||||
<plunder probability="50" minimum="3" maximum="8" factor="100">
|
||||
<plunder id="plunder.village" probability="50"
|
||||
minimum="3" maximum="8" factor="100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="4" maximum="12" factor="100">
|
||||
<plunder id="plunder.village.extra" probability="100"
|
||||
minimum="4" maximum="12" factor="100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -3016,11 +3022,13 @@
|
|||
minimum-size="8" maximum-size="10"
|
||||
minimum-growth="2" maximum-growth="10"
|
||||
trade-bonus="3" convert-threshold="100">
|
||||
<plunder probability="100" minimum="3" maximum="8" factor="200">
|
||||
<plunder id="plunder.village.capital" probability="100"
|
||||
minimum="3" maximum="8" factor="200">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="3" maximum="8" factor="300">
|
||||
<plunder id="plunder.village.capital.extra" probability="100"
|
||||
minimum="3" maximum="8" factor="300">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -3101,11 +3109,13 @@
|
|||
minimum-size="8" maximum-size="12"
|
||||
minimum-growth="3" maximum-growth="12"
|
||||
trade-bonus="3" convert-threshold="100">
|
||||
<plunder probability="100" minimum="2" maximum="6" factor="2100">
|
||||
<plunder id="plunder.inca" probability="100"
|
||||
minimum="2" maximum="6" factor="2100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="2" maximum="6" factor="3100">
|
||||
<plunder id="plunder.inca.extra" probability="100"
|
||||
minimum="2" maximum="6" factor="3100">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -3118,11 +3128,13 @@
|
|||
minimum-size="10" maximum-size="12"
|
||||
minimum-growth="4" maximum-growth="14"
|
||||
trade-bonus="4" convert-threshold="100">
|
||||
<plunder probability="100" minimum="2" maximum="6" factor="3000">
|
||||
<plunder id="plunder.inca.capital" probability="100"
|
||||
minimum="2" maximum="6" factor="3000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="3" maximum="8" factor="4000">
|
||||
<plunder id="plunder.inca.capital.extra" probability="100"
|
||||
minimum="3" maximum="8" factor="4000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -3142,11 +3154,13 @@
|
|||
minimum-size="8" maximum-size="12"
|
||||
minimum-growth="3" maximum-growth="12"
|
||||
trade-bonus="3" convert-threshold="100">
|
||||
<plunder probability="100" minimum="5" maximum="9" factor="1000">
|
||||
<plunder id="plunder.aztec" probability="100"
|
||||
minimum="5" maximum="9" factor="1000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="11" maximum="15" factor="1000">
|
||||
<plunder id="plunder.aztec.extra" probability="100"
|
||||
minimum="11" maximum="15" factor="1000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
@ -3159,11 +3173,13 @@
|
|||
minimum-size="10" maximum-size="12"
|
||||
minimum-growth="4" maximum-growth="14"
|
||||
trade-bonus="4" convert-threshold="100">
|
||||
<plunder probability="100" minimum="7" maximum="12" factor="1000">
|
||||
<plunder id="plunder.aztec.capital" probability="100"
|
||||
minimum="7" maximum="12" factor="1000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="false"/>
|
||||
</plunder>
|
||||
<plunder probability="100" minimum="16" maximum="19" factor="1000">
|
||||
<plunder id="plunder.aztec.capital.extra" probability="100"
|
||||
minimum="16" maximum="19" factor="1000">
|
||||
<scope ability-id="model.ability.plunderNatives"
|
||||
ability-value="true"/>
|
||||
</plunder>
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
<xs:element ref="ability"/>
|
||||
<xs:element name="gifts" type="RandomRange"/>
|
||||
<xs:element ref="modifier"/>
|
||||
<xs:element name="plunder" type="RandomRange"/>
|
||||
<xs:element ref="plunder"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="id" use="required" type="SettlementTypeId"/>
|
||||
<xs:attribute name="preserve" use="optional" type="xs:boolean"/>
|
||||
|
@ -202,4 +202,16 @@
|
|||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="plunder">
|
||||
<xs:complexType>
|
||||
<xs:complexContent>
|
||||
<xs:extension base="RandomRange" >
|
||||
<!-- Should be required -->
|
||||
<xs:attribute name="id" type="xs:string" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
</xs:schema>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package net.sf.freecol.common.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
@ -218,6 +219,26 @@ public class SettlementType extends FreeColSpecObjectType {
|
|||
return (pt == null) ? null : pt.getPlunder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of plunder types.
|
||||
*
|
||||
* @return The list of {@code PlunderType}s.
|
||||
*/
|
||||
public List<PlunderType> getPlunderTypes() {
|
||||
return (this.plunder == null) ? Collections.<PlunderType>emptyList()
|
||||
: this.plunder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plunder.
|
||||
*
|
||||
* @param pt The {@code PlunderType} to add.
|
||||
*/
|
||||
private void addPlunder(PlunderType pt) {
|
||||
if (plunder == null) plunder = new ArrayList<>();
|
||||
plunder.add(pt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the range of gifts available to a unit.
|
||||
*
|
||||
|
@ -238,15 +259,6 @@ public class SettlementType extends FreeColSpecObjectType {
|
|||
return GoodsContainer.CARGO_SIZE * getClaimableRadius();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plunder.
|
||||
*
|
||||
* @param pt The {@code PlunderType} to add.
|
||||
*/
|
||||
private void addPlunder(PlunderType pt) {
|
||||
if (plunder == null) plunder = new ArrayList<>();
|
||||
plunder.add(pt);
|
||||
}
|
||||
|
||||
|
||||
// Serialization
|
||||
|
|
|
@ -2367,6 +2367,25 @@ public final class Specification {
|
|||
3.0f, Modifier.ModifierType.ADDITIVE, coronado, 0));
|
||||
}
|
||||
// end @compat 0.11.5
|
||||
|
||||
// @compat 0.11.6
|
||||
// PlunderType became a FCSOT and thus gained identifiers
|
||||
for (IndianNationType nt : indianNationTypes) {
|
||||
for (SettlementType st : nt.getSettlementTypes()) {
|
||||
for (PlunderType pt : st.getPlunderTypes()) {
|
||||
if (pt.getId() == null) {
|
||||
Scope scope = find(pt.getScopes(),
|
||||
matchKey("model.ability.plunderNatives",
|
||||
Scope::getAbilityId));
|
||||
String id = "plunder." + nt.getSuffix()
|
||||
+ ((st.isCapital()) ? ".capital" : "")
|
||||
+ ((scope == null) ? "" : ".extra");
|
||||
pt.setId(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// end @compat 0.11.6
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue