Revision: 9253
http://sourceforge.net/p/vassalengine/svn/9253
Author: swampwallaby
Date: 2017-06-30 04:11:42 +0000 (Fri, 30 Jun 2017)
Log Message:
-----------
Crete Tweaks
Modified Paths:
--------------
VSQL-src/trunk/tdc/CommandRangeChecker.java
VSQL-src/trunk/tdc/UnitInfo.java
VSQL-src/trunk/tdc/attack/AttackView.java
Modified: VSQL-src/trunk/tdc/CommandRangeChecker.java
===================================================================
--- VSQL-src/trunk/tdc/CommandRangeChecker.java 2017-06-29 06:38:19 UTC (rev 9252)
+++ VSQL-src/trunk/tdc/CommandRangeChecker.java 2017-06-30 04:11:42 UTC (rev 9253)
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (c) 2005-2012 by Brent Easton
+ * Copyright (c) 2005-2017 by Brent Easton
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -78,7 +78,7 @@
info = i;
piece = p;
setLeaderAttributes();
- map = p.getMap();
+ map = p.getMap();
}
/**
@@ -88,6 +88,8 @@
* Obscured to me must be skipped Commandos in D-Day must be within 2 hexes of
* another Commando unit
*
+ * In Crete, Greek units must be in command range of any allied leader
+ *
*/
protected void setLeaderAttributes() {
unitType = (String) piece.getProperty(TdcProperties.TYPE);
@@ -101,34 +103,35 @@
return;
}
- canBeActivated = Boolean.valueOf((String) piece.getProperty(TdcProperties.ACTIVE))
- .booleanValue()
- && !Boolean.TRUE.equals(piece.getProperty(Properties.INVISIBLE_TO_ME))
- && !Boolean.TRUE.equals(piece.getProperty(Properties.OBSCURED_TO_ME))
- && !"Leader".equals(piece.getProperty("Type"));
- alwaysInCommand = isAlwaysInCommand();
- if (canBeActivated && !alwaysInCommand) {
- targetHasTelephoneCapbility = hasTelephoneCapability(piece);
+ // Greek unit in Crete
+ if (info.isGreek() && UnitInfo.isCreteRules()) {
+ canBeActivated = true;
+ alwaysInCommand = false;
+ leaderFormationType = TdcProperties.ARMY;
+ leaderFormationValue = TdcProperties.ARMY_ALLIED;
+ }
+ else {
+ canBeActivated = Boolean.valueOf((String) piece.getProperty(TdcProperties.ACTIVE)).booleanValue() && !Boolean.TRUE.equals(piece.getProperty(Properties.INVISIBLE_TO_ME))
+ && !Boolean.TRUE.equals(piece.getProperty(Properties.OBSCURED_TO_ME)) && !"Leader".equals(piece.getProperty("Type"));
+ alwaysInCommand = isAlwaysInCommand();
+ if (canBeActivated && !alwaysInCommand) {
+ targetHasTelephoneCapbility = hasTelephoneCapability(piece);
- String unitClass = (String) piece.getProperty(TdcProperties.CLASS);
- if (unitClass != null) {
- if (unitClass.equals(TdcProperties.INFANTRY) || unitClass.equals(TdcProperties.VEHICLE)
- || unitClass.equals(TdcProperties.GUN) || unitClass.equals(TdcProperties.CLASS_LANDING_CRAFT)) {
- leaderFormationType = TdcProperties.FORMATION;
- pieceFormation = (String) piece.getProperty(TdcProperties.FORMATION) + "";
- leaderFormationValue = pieceFormation;
- leaderFormation2Value = (String) piece.getProperty(TdcProperties.FORMATION2) + "";
- isUnitIndependent = Boolean.valueOf(
- (String) piece.getProperty(TdcProperties.IS_INDEPENDENT)).booleanValue();
- isUnitNonFormationCommand = Boolean.valueOf(
- (String) piece.getProperty(TdcProperties.NON_FORMATION_COMMAND)).booleanValue()
- && !Boolean.valueOf((String) piece.getProperty(TdcProperties.COMMAND_BREAKDOWN))
- .booleanValue();
- if (leaderFormationValue != null) {
- if (isUnitIndependent || isUnitNonFormationCommand) {
- leaderFormationType = TdcProperties.DIVISION;
- leaderFormationValue = (String) piece.getProperty(leaderFormationType) + "";
- leaderFormation2Value = (String) piece.getProperty(TdcProperties.DIVISION2) + "";
+ String unitClass = (String) piece.getProperty(TdcProperties.CLASS);
+ if (unitClass != null) {
+ if (unitClass.equals(TdcProperties.INFANTRY) || unitClass.equals(TdcProperties.VEHICLE) || unitClass.equals(TdcProperties.GUN) || unitClass.equals(TdcProperties.CLASS_LANDING_CRAFT)) {
+ leaderFormationType = TdcProperties.FORMATION;
+ pieceFormation = (String) piece.getProperty(TdcProperties.FORMATION) + "";
+ leaderFormationValue = pieceFormation;
+ leaderFormation2Value = (String) piece.getProperty(TdcProperties.FORMATION2) + "";
+ isUnitIndependent = Boolean.valueOf((String) piece.getProperty(TdcProperties.IS_INDEPENDENT)).booleanValue();
+ isUnitNonFormationCommand = Boolean.valueOf((String) piece.getProperty(TdcProperties.NON_FORMATION_COMMAND)).booleanValue() && !Boolean.valueOf((String) piece.getProperty(TdcProperties.COMMAND_BREAKDOWN)).booleanValue();
+ if (leaderFormationValue != null) {
+ if (isUnitIndependent || isUnitNonFormationCommand) {
+ leaderFormationType = TdcProperties.DIVISION;
+ leaderFormationValue = (String) piece.getProperty(leaderFormationType) + "";
+ leaderFormation2Value = (String) piece.getProperty(TdcProperties.DIVISION2) + "";
+ }
}
}
}
@@ -143,10 +146,10 @@
*
* @return Always in Command or c) It's in an Artillery Park on the Bir
* Hacheim board.
- *
- * TGD New Rules :-
- * Artillery in Artillery Parks always in command
- * Red TQR units (except Commandos) always in command
+ *
+ * TGD New Rules :-
+ * Artillery in Artillery Parks always in command
+ * Red TQR units (except Commandos) always in command
*/
protected boolean isAlwaysInCommand() {
@@ -157,7 +160,7 @@
if (Boolean.valueOf((String) piece.getProperty(TdcProperties.ALWAYS_IN_COMMAND)).booleanValue()) {
return true;
}
-
+
if (info.isRedTqr()) {
return true;
}
@@ -193,7 +196,7 @@
return true;
}
}
-
+
// TGD Artillery units in Artillery Parks
if (UnitInfo.isTgdRules()) {
if (TdcProperties.TGD_ARTY_PARK.equals(piece.getProperty(BasicPiece.CURRENT_ZONE))) {
@@ -200,7 +203,7 @@
return true;
}
}
-
+
// Tinian Artillery units in Artillery Parks
if (UnitInfo.isTinianRules()) {
final String zone = (String) piece.getProperty(BasicPiece.CURRENT_ZONE);
@@ -230,8 +233,7 @@
// Only American units have telephone capability in WED and earlier
// In WED only American Leaders have Telephone property, all units are
// assumed to have it
- if (TdcProperties.DIVISION_82AB.equals(division)
- || TdcProperties.DIVISION_101AB.equals(division)) {
+ if (TdcProperties.DIVISION_82AB.equals(division) || TdcProperties.DIVISION_101AB.equals(division)) {
// Leader must have the telephone symbol
if (isLeader && !hasTelephone) {
@@ -240,13 +242,10 @@
// Both Leader and Units must be in an OP, strongpoint or City, Town or
// Fortified terrain
- final String terrain = (String) TdcMap.getTerrainProperty(piece,
- TerrainBasicPiece.CURRENT_TERRAIN);
- final String strongpoint = (String) TdcMap.getTerrainProperty(piece,
- TdcProperties.STRONGPOINT);
+ final String terrain = (String) TdcMap.getTerrainProperty(piece, TerrainBasicPiece.CURRENT_TERRAIN);
+ final String strongpoint = (String) TdcMap.getTerrainProperty(piece, TdcProperties.STRONGPOINT);
final String op = (String) TdcMap.getTerrainProperty(piece, TdcProperties.OP);
- return "true".equals(op) || "true".equals(strongpoint) || TdcProperties.CITY.equals(terrain)
- || TdcProperties.TOWN.equals(terrain) || TdcProperties.FORTIFIED.equals(terrain);
+ return "true".equals(op) || "true".equals(strongpoint) || TdcProperties.CITY.equals(terrain) || TdcProperties.TOWN.equals(terrain) || TdcProperties.FORTIFIED.equals(terrain);
}
// In D-DAY, Units of some Divisions can have telephone capability
else if (TdcProperties.DIVISION_716.equals(division) || TdcProperties.DIVISION_352.equals(division)) {
@@ -256,8 +255,7 @@
}
// Check if Telephone has been cut
- final boolean isTelephoneCut = "2".equals(piece.getProperty(TdcProperties.LAYER_TELEPHONE
- + "_Level"));
+ final boolean isTelephoneCut = "2".equals(piece.getProperty(TdcProperties.LAYER_TELEPHONE + "_Level"));
if (isTelephoneCut) {
return false;
}
@@ -270,10 +268,8 @@
// Leaders must be in appropriate terrain or stacked with another
// telephone unit.
// Town, City or Fortified Hex
- final String terrain = (String) TdcMap.getTerrainProperty(piece,
- TerrainBasicPiece.CURRENT_TERRAIN);
- if (TdcProperties.CITY.equals(terrain) || TdcProperties.TOWN.equals(terrain)
- || TdcProperties.FORTIFIED.equals(terrain)) {
+ final String terrain = (String) TdcMap.getTerrainProperty(piece, TerrainBasicPiece.CURRENT_TERRAIN);
+ if (TdcProperties.CITY.equals(terrain) || TdcProperties.TOWN.equals(terrain) || TdcProperties.FORTIFIED.equals(terrain)) {
return true;
}
@@ -316,8 +312,7 @@
return visitor.isInCommand();
}
else {
- if (leaderFormationValue != null && leaderFormationValue.length() > 0
- && piece.getMap() != null) {
+ if (leaderFormationValue != null && leaderFormationValue.length() > 0 && piece.getMap() != null) {
String s = TdcProperties.CLASS + "=" + TdcProperties.LEADER + " && " + leaderFormationType;
if (leaderFormation2Value.length() > 0) {
@@ -396,7 +391,7 @@
return;
}
}
-
+
/*
* Regardless of command range, American units in certain hexes are in
* command if their leader is also in a telephone hex
@@ -451,19 +446,18 @@
GamePiece piece;
String formation;
boolean inCommand;
-
-
- public CommandoVisitor (GamePiece piece) {
+
+ public CommandoVisitor(GamePiece piece) {
this.piece = piece;
- formation = (String) piece.getProperty(TdcProperties.FORMATION);
+ formation = (String) piece.getProperty(TdcProperties.FORMATION);
inCommand = false;
}
-
+
/* Is Unit In command? */
public boolean isInCommand() {
return inCommand;
}
-
+
public Object visitStack(Stack s) {
for (int i = 0; i < s.getPieceCount(); i++) {
apply(s.getPieceAt(i));
Modified: VSQL-src/trunk/tdc/UnitInfo.java
===================================================================
--- VSQL-src/trunk/tdc/UnitInfo.java 2017-06-29 06:38:19 UTC (rev 9252)
+++ VSQL-src/trunk/tdc/UnitInfo.java 2017-06-30 04:11:42 UTC (rev 9253)
@@ -432,6 +432,10 @@
return TdcProperties.ENGINEER.equals(unitSubClass);
}
+ public boolean isGreek() {
+ return TdcProperties.SUBCLASS_GREEK.equals(unitSubClass);
+ }
+
public boolean isTank() {
return isVehicle() && TdcRatings.WHITE.equals(getFireColor()) && "Red".equals(ratings.get(TdcRatings.MOVE_COLOUR));
}
Modified: VSQL-src/trunk/tdc/attack/AttackView.java
===================================================================
--- VSQL-src/trunk/tdc/attack/AttackView.java 2017-06-29 06:38:19 UTC (rev 9252)
+++ VSQL-src/trunk/tdc/attack/AttackView.java 2017-06-30 04:11:42 UTC (rev 9253)
@@ -34,6 +34,7 @@
import net.miginfocom.swing.MigLayout;
import tdc.AttackWizard;
import tdc.AttackWizard.WizardTargetCommand;
+import tdc.UnitInfo;
import VASSAL.build.GameModule;
import VASSAL.command.Command;
import VASSAL.counters.GamePiece;
@@ -197,8 +198,8 @@
mainPanel.add(specialAttack,WIDTH+",wrap");
}
- // Central Panel for Air Attack - Air Defence roll
- if (myModel.isAirPower()) {
+ // Central Panel for Air Attack - Air Defence roll - D-Day rules only
+ if (myModel.isAirPower() && UnitInfo.isTgdRules()) {
specialAttack = new JPanel(new MigLayout("hidemode 3","[center,grow]"));
final int airDefenceRating = myModel.getAirDefenceRating();
final String airDefenceTerrain = myModel.getAirDefenceDescription();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
vassalengine-svn mailing list
vas...@li...
https://lists.sourceforge.net/lists/listinfo/vassalengine-svn
|