It is currently Fri Dec 15, 2017 12:15 pm

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Coding Skeletons
PostPosted: Thu Dec 21, 2006 3:47 pm 
Offline
User avatar

Joined: Thu Jun 22, 2006 3:25 am
Posts: 3233
CO SKELETON
This is just what is required at minimum for a CO.

Code:

/*
 *Flak.java
 *Author: Adam Dziuk, Kosheh
 *Contributors:
 *Creation:
 *The Flak class is used to create an instance of the Black Hole CO Flak (copyright Intelligent Systems).
 */

import java.util.Random;

public class Flak extends CO{
   
    //constructor
    public Flak() {
        name = "Flak";
        id = 19;
   //Make sure to give it a new ID. (See Urusan's instructions in programming)
       
        String[] TagCOsx = {"Adder"}; //Names of COs with special tags
        String[] TagNamesx = {"Totally Flaked"}; //Names of the corresponding Tags
        int[] TagStarsx = {0}; //Number of stars for each special tag.
        int[] TagPercentx = {105}; //Percent for each special tag.
       
        TagCOs = TagCOsx;
        TagNames = TagNamesx;
        TagStars = TagStarsx;
        TagPercent = TagPercentx;
       
        String[] COPowerx =
        {"You can't hide from me! I'll hunt you down like a dog!"};
       
        String[] Victoryx =
        {"I've still got what it takes!"};
       
        String[] Swapx =
        {"I'll crush you all!"}  ;
       
        Swap = Swapx;
        COPower = COPowerx;
        Victory = Victoryx;
       
        COPName = "CO Power";
        SCOPName = "Super CO Power";
        COPStars = 3.0;
        maxStars = 6.0;
        positiveLuck = 25;
        negativeLuck = 10;
        this.army = army;
        style = BLACK_HOLE;
    }
   
        //used to get the attack bonus for damage calculation
    public int getAtk(Unit attacker, Unit defender){
        return 100;
    }
   
    //used to get the defense bonus for damage calculation
    public int getDef(Unit attacker, Unit defender){
        return 100;
    }
   
        public void setChange(Unit u){};
   
    public void unChange(Unit u){};
   
    //carries out Adder's CO Power, called by CO.activateCOP()
    public void COPower(){
        COP = true;
    }
   
    //carries out Adder's Super CO Power, called by CO.activateSCOP()
    public void superCOPower(){
        SCOP = true;

    }   
   
    //used to deactivate Adder's CO Power the next day
    public void deactivateCOP(){
           COP = false;

    }
   
    //used to deactivate Adder's Super CO Power the next day
    public void deactivateSCOP(){
        SCOP = false;
    }
}



Other things you can specify as numbers or boolean flags. Include these with the Day to day stats (such as CO Power cost), or make them happen when a Power is triggered. Don't forget to make the CO Power turnoff turn them back to normal. (DeactivateCOP/SCOP functions)

Change repair rates: repairHp = x;
Change Positive luck: positiveLuck = xx;
Include/Change Negative Luck: negativeLuck = 10;
Set/Unset Hidden HP: hiddenHP = true/false;
Change deployment costs: costMultiplier = yyy;
Reduce enemy terrain stars: enemyTerrainPenalty = x;
Change Counterattack Multiplier: counterAttack = 100;
Set/Unset Piercing vision: piercingVision = true/false;
Set/Unset First Strike Counterattacks: firstStrike = true/false;

UNIT SKELETON
Just the format of a unit. Not too much to say here, it's all pretty self-explanatory.

Code:
/*
 *Tank.java
 *Author: Killian Hanlon
 *Contributors:
 *Creation: 17/7/06
 *The Tank class is used to create an instance of theTank Unit
 */

public class Tank extends Unit{
   
    //constructor
    public Tank(int row, int col, Army arm, Map m) {
        super(new Location(row, col),arm,m);
       
        //Statistics
        name = "Tank";
        unitType = 2; //The Unit's ID Number
        moveType = MOVE_TREAD; //Movement Type (Tread, Tyre, Sea, etc.)
        move = 6; //How far the unit can move
        price = 7000; //How much the unit costs to build.
        maxGas = 70; //Maximum size of the fuel tank.
        maxAmmo = 9; //The most ammo this unit can hold.
        vision = 3; //How far it can see in Fog of War
        minRange = 1; //The shortest possible firing distance.
        maxRange = 1; //Longest possible firing distance. Set both to 1 to make the unit a direct.
       
        starValue = 1.0;
       
        //Fills the Unit's gas and ammo
        gas = maxGas;
        ammo = maxAmmo;
       
        //make CO adjustments
        arm.getCO().setChange(this);
    }
}


TERRAIN SKELETON
Also quite simple, the basic Terrain (non-capturable).

Code:
/*
 *River.java
 *Author: Limbo the Monkey
 *Contributors:
 *Creation: 17/7/06
 *The River class is used to create an instance of the River Terrain.
 */

public class River extends Terrain{
   
    //constructor
    public River(){
        //Statistics
        name = "River"; //The Terrain's Name
        move = new int[] {2,1,-1,-1,1,-1,-1,1,-1,1}; //Movement Costs for each movement class.
        basemove = move; //Allows movement to be changed back after terrain altering powers.
        def  = 0; //Terrain Stars that this gives
        index = 5; //The Terrain's ID number
        urban = false; //If the terrain is an urban terrain. If unspecified, it is false by default.
    }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 9:30 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group