1 /* |
|
2 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2011-2012 Richard Deurwaarder <xeli@xelification.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 */ |
|
18 |
|
19 package org.hedgewars.hedgeroid.Datastructures; |
|
20 |
|
21 import org.hedgewars.hedgeroid.EngineProtocol.PascalExports; |
|
22 |
|
23 public class Weapon implements Comparable<Weapon>{ |
|
24 public static final String DIRECTORY_WEAPON = "weapons"; |
|
25 public static final int maxWeapons = PascalExports.HWgetNumberOfWeapons(); |
|
26 |
|
27 private String name; |
|
28 private String QT; |
|
29 private String prob; |
|
30 private String delay; |
|
31 private String crate; |
|
32 |
|
33 public Weapon(String _name, String _QT, String _prob, String _delay, String _crate){ |
|
34 name = _name; |
|
35 |
|
36 //Incase there's a newer ammoStore which is bigger we append with zeros |
|
37 StringBuffer sb = new StringBuffer(); |
|
38 while(_QT.length() + sb.length() < maxWeapons){ |
|
39 sb.append('0'); |
|
40 } |
|
41 |
|
42 QT = String.format("e%s %s%s", "ammloadt", _QT, sb); |
|
43 prob = String.format("e%s %s%s", "ammprob", _prob, sb); |
|
44 delay = String.format("e%s %s%s", "ammdelay", _delay, sb); |
|
45 crate = String.format("e%s %s%s", "ammreinf", _crate, sb); |
|
46 } |
|
47 |
|
48 public String toString(){ |
|
49 return name; |
|
50 } |
|
51 |
|
52 public int compareTo(Weapon another) { |
|
53 return name.compareTo(another.name); |
|
54 } |
|
55 } |
|