1 package org.argosfields.model;
2
3 import java.io.Serializable;
4
5 import org.apache.commons.lang.builder.EqualsBuilder;
6 import org.apache.commons.lang.builder.HashCodeBuilder;
7 import org.apache.commons.lang.builder.ToStringBuilder;
8
9
10 /***
11 * Tile.java
12 *
13 * @author Xavier Cho
14 * @version $Revision: 1.2 $ $Date: 2003/12/27 07:39:09 $
15 */
16 public class Tile implements Serializable {
17 public static final int WIDTH = 32;
18 public static final int HEIGHT = 28;
19
20 private int id;
21 private int terrainFlag;
22 private int iconIndex;
23 private String name;
24 private int offenseModifier;
25 private int defenseModifier;
26 private int movementCost;
27 private int mapColor;
28 private Unit unit;
29
30 public Tile(final int id) {
31 int[] data = TileDefinitions.getTileData(id);
32
33 this.id = id;
34 this.terrainFlag = data[0];
35 this.iconIndex = data[1];
36 this.offenseModifier = data[2];
37 this.defenseModifier = data[3];
38 this.movementCost = data[4];
39 this.mapColor = data[6];
40 }
41
42 /***
43 * @return
44 */
45 public int getDefenseModifier() {
46 return defenseModifier;
47 }
48
49 /***
50 * @return
51 */
52 public int getIconIndex() {
53 return iconIndex;
54 }
55
56 /***
57 * @return
58 */
59 public int getId() {
60 return id;
61 }
62
63 /***
64 * @return
65 */
66 public int getTerrainFlag() {
67 return terrainFlag;
68 }
69
70 /***
71 * @return
72 */
73 public int getMovementCost() {
74 return movementCost;
75 }
76
77 /***
78 * @return
79 */
80 public String getName() {
81 return name;
82 }
83
84 /***
85 * @return
86 */
87 public int getOffenseModifier() {
88 return offenseModifier;
89 }
90
91 /***
92 * @return
93 */
94 public int getMapColor() {
95 return mapColor;
96 }
97
98 /***
99 * @return
100 */
101 public Unit getUnit() {
102 return unit;
103 }
104
105 /***
106 * @param unit
107 */
108 public void setUnit(final Unit unit) {
109 this.unit = unit;
110 }
111
112 /***
113 * @see java.lang.Object#equals(java.lang.Object)
114 */
115 public boolean equals(final Object obj) {
116 return EqualsBuilder.reflectionEquals(obj, this);
117 }
118
119 /***
120 * @see java.lang.Object#hashCode()
121 */
122 public int hashCode() {
123 return HashCodeBuilder.reflectionHashCode(this);
124 }
125
126 /***
127 * @see java.lang.Object#toString()
128 */
129 public String toString() {
130 ToStringBuilder builder = new ToStringBuilder(this);
131 builder.append("id", name);
132 builder.append("name", name);
133 builder.append("iconIndex", iconIndex);
134 builder.append("unit", unit);
135
136 return builder.toString();
137 }
138 }
This page was automatically generated by Maven