source: advance-wars/src/com/medievaltech/unit/Soldier.java@ 331d180

Last change on this file since 331d180 was 41c11dd, checked in by dportnoy <devnull@…>, 13 years ago

Added cities to the game, moved the map to a new static class, and added incomplete support for capturing cities with soldiers.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.medievaltech.unit;
2
3import java.util.List;
4
5import android.graphics.Point;
6
7import com.medievaltech.advancewars.Player;
8import com.medievaltech.advancewars.Static;
9import com.medievaltech.advancewars.Tile;
10import com.medievaltech.advancewars.Enum.*;
11
12public class Soldier extends Unit{
13 public Soldier(Player p)
14 {
15 super(p);
16
17 move = 3;
18
19 type = UnitType.LAND;
20 minAttackRange = 1;
21 maxAttackRange = 1;
22 }
23
24 @Override
25 public void move(Point point) {
26 // TODO Auto-generated method stub
27
28 }
29
30 @Override
31 public void attack(Point point) {
32 Tile t = Static.map.getTile(point);
33
34 if(t.currentUnit == null && t.currentBuilding != null) {
35 t.currentBuilding.currentHealth -= this.currentHealth;
36
37 if(t.currentBuilding.currentHealth <= 0) {
38 t.currentBuilding.owner = this.owner;
39 t.currentBuilding.currentHealth = t.currentBuilding.maxHealth;
40 }
41 }
42 }
43
44 @Override
45 public List<Point> getMovementRange() {
46 return super.getMovementRange();
47 }
48
49 @Override
50 public void die()
51 {
52
53 }
54
55 @Override
56 public List<Point> getAttackRange() {
57 // TODO Auto-generated method stub
58 return null;
59 }
60
61
62}
Note: See TracBrowser for help on using the repository browser.