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

Last change on this file 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
RevLine 
[113d7cf]1package com.medievaltech.unit;
[a0f5455]2
3import java.util.List;
4
5import android.graphics.Point;
6
[41c11dd]7import com.medievaltech.advancewars.Player;
8import com.medievaltech.advancewars.Static;
9import com.medievaltech.advancewars.Tile;
[fea4b77]10import com.medievaltech.advancewars.Enum.*;
11
[a0f5455]12public class Soldier extends Unit{
[c3ad11c]13 public Soldier(Player p)
[78d3c6f]14 {
[1a1e8c7]15 super(p);
[ebaddd9]16
[b23048f]17 move = 3;
[78d3c6f]18
[fea4b77]19 type = UnitType.LAND;
[78d3c6f]20 minAttackRange = 1;
21 maxAttackRange = 1;
[1a1e8c7]22 }
23
[a0f5455]24 @Override
[a79ce1b]25 public void move(Point point) {
[a0f5455]26 // TODO Auto-generated method stub
[a79ce1b]27
[a0f5455]28 }
29
30 @Override
[a79ce1b]31 public void attack(Point point) {
[41c11dd]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 }
[a0f5455]42 }
43
44 @Override
[ebaddd9]45 public List<Point> getMovementRange() {
46 return super.getMovementRange();
[a0f5455]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.