Changeset 41c11dd in advance-wars for src/com/medievaltech/unit/Soldier.java


Ignore:
Timestamp:
Aug 27, 2011, 1:56:46 AM (13 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
331d180
Parents:
511177b
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/medievaltech/unit/Soldier.java

    r511177b r41c11dd  
    55import android.graphics.Point;
    66
     7import com.medievaltech.advancewars.Player;
     8import com.medievaltech.advancewars.Static;
     9import com.medievaltech.advancewars.Tile;
    710import com.medievaltech.advancewars.Enum.*;
    811
     
    2730        @Override
    2831        public void attack(Point point) {
    29                 // TODO Auto-generated method stub
    30        
     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                }
    3142        }
    3243
Note: See TracChangeset for help on using the changeset viewer.