It is currently Mon Dec 18, 2017 3:15 am

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Yukio! Less bugs, DS bug still here, 0% stays 0%
PostPosted: Fri Jan 05, 2007 10:27 am 
Offline
User avatar

Joined: Thu Sep 21, 2006 6:48 am
Posts: 3681
Location: Location, Location
Yukio's more or less completely finished. Problem is - with the code the way it is, if you use Yukio's COP and then switch COs in a tag match, the enemy will be completely drained of funds at the end of Yukio's turn, and will not build 8HP units.

This is going to take a while to fix, and this is the reason that I hope fervently that we never have COs that mess with enemy stats. Right now I can only think of something similar to a 'pass on power' method that transfers itself, but that'll take a while to implement.

New! There is no easy way to jump from 0% damage to 5% damage - because no matter how much you multiply 0 by, it stays zero. So I'm going to fall to my knees and ask that Yukio's 5% damage increase doesn't apply to 0% matchups.

Note 2 ! Actually, I won't. I'll just implement some sort of... if (store == 0), damage enemy(5, true) salvage. Uh...I can work on it.

This CO also uses afterEnemyAction!

Code:
/*
 *Yukio
 *Author: Albert Lai
 *Contributors:
 *Creation: December 11, 2006
 * Hidden HP (lol, not implemented yet)
 * If yousa don't hand over de battle, youse gunna sleep with da fishes, ya hear?
 */

import java.util.Random;

public class Yukio extends CO{
   
    //constructor
    public Yukio() {
        name = "Yukio";
        id = 38;
       
        String[] COPowerx =
        {"I made them an offer they couldn't refuse...",
        "How do you know you don't like bribes if you've never taken one?",
        "Bring up a list of all contacts in the region.",
        "If you can't beat them, buy them.",
        "A man in my position can't afford to be made to look ridiculous.",
        "The richest man is the one with the most powerful friends." };
       
        String[] Victoryx =
        {"The key to a successful leader is influence.",
        "Victory depends on who you know and who you can buy.",
        "If history has taught us anything, it's that you can kill anyone." };
       
        String[] Swapx =
        {"It's nothing personal. Strictly business.",
        "It's time to see what my associates can do." };
       
        COPower = COPowerx;
        Victory = Victoryx;
        Swap = Swapx;
       
        //No special tags
        String[] TagCOsx = {"Eric","Edward","Carmen","Sonja","Kanbei", "Sabaki"}; //Names of COs with special tags
        String[] TagNamesx = {"Criminal Intent", "Black Merchants", "Perceivable Opaque", "Dual Strike", "Dual Strike", "Dual Strike"}; //Names of the corresponding Tags
        int[] TagStarsx = {1,1,1,0,0,0}; //Number of stars for each special tag.
        int[] TagPercentx = {110,110,110, 90, 90, 105}; //Percent for each special tag.
       
        TagCOs = TagCOsx;
        TagNames = TagNamesx;
        TagStars = TagStarsx;
        TagPercent = TagPercentx;
       
        COPName = "Criminal Connections";
        SCOPName = "Underworld Assault";
        COPStars = 2.0;
        maxStars = 6.0;
        this.army = army;
        style = AMBER_CORONA;
       
        fundingMultiplier = 95;
    }
   
//used to get the attack bonus for damage calculation
    public int getAtk(Unit attacker, Unit defender)
    {
        double store; //If store isn't double, bad things happen. Expect a +/- 1% problem here or there.
     
        int baseDamage = BaseDMG.find(attacker.getAmmo(), attacker.getUType(), defender.getUType(),army.getBattle().getBattleOptions().isBalance());
            if(defender instanceof Submarine && defender.dived)baseDamage = ((Submarine)defender).getDivedDamage(attacker.getUType());
            else
            if(defender instanceof Stealth && defender.dived)baseDamage = ((Stealth)defender).getHiddenDamage(attacker.getUType());
       
        if(SCOP||COP)
            store = (int)Math.floor((attacker.getDisplayHP()/10.0 * ((baseDamage*1.1 + (attacker.getArmy().getComTowers()*10) + attacker.getArmy().getAtkPercent())) * ((200.0-(defender.getArmy().getCO().getDef(attacker,defender)))/100.0)));
        else
            store = (int)Math.floor((attacker.getDisplayHP()/10.0 * ((baseDamage + (attacker.getArmy().getComTowers()*10) + attacker.getArmy().getAtkPercent())) * ((200.0-(defender.getArmy().getCO().getDef(attacker,defender)))/100.0)));
        //Store is equal to damage, before the 5% bonus is added and ignoring terrain defense.
           
        int tdef = 0;
        if(defender.getMType() != defender.MOVE_AIR)
            tdef = defender.getMap().find(defender).getTerrain().getDef();
        if(tdef < 0)tdef = 0;
        System.out.println(tdef);
        //tdef *= defender.getArmy().getCO().getTerrainDefenseMultiplier();
        //I'm going to go out on a limb here and make sure he doesn't rape SCOP Lash
       
        if(store!=0) //No divide by zero here, nosirree.
        {
        if(SCOP)
            return (int)((tdef*30)+100*((store+5)/store));
        if(COP)
            return (int)(100*((store+5)/store));
        else
            {
            store = 100*((store+5)/store);
            return (int)(store);
            }
        }
        else
            return 100; //error checking
       
    }
   
    public void setChange(Unit u){
       
    }
   
    public void unChange(Unit u){
       
    }
   
   
//used to get the defense bonus for damage calculation
    public int getDef(Unit attacker, Unit defender){
        if(SCOP || COP)return 110;
        return 100;
    }
   
//carries out Blandie's CO Power, called by CO.activateCOP()
    public void COPower(){
        COP = true;
    }
   
//carries out Blandie's Super CO Power, called by CO.activateSCOP()
    public void superCOPower(){
        SCOP = true;

    }
   
//used to deactivate Blandie's CO Power the next day
    public void deactivateCOP(){
        COP = false;     
        Army[] armies = army.getBattle().getArmies(); //Get all armies
        for(int i = 0; i < armies.length; i++)
        {
            if(armies[i].getSide() != army.getSide())
            {
                armies[i].removeFunds((armies[i].getFunds())); //Removes the funds.
            }
        }
        //Sets funds to zero
    }
   
//used to deactivate Blandie's Super CO Power the next day
    public void deactivateSCOP()
    {
        SCOP = false;
    }
   
    public void afterEnemyAction(Unit u, int index, Unit repaired)
    {
        if(COP)
            if(index == 15)
                u.damage(20,false);
    }
}


_________________
"I got this [dragon tattoo] while a teenager. I met the greatest girl in the world and now I'm married. Problem is, she's afraid of dragons. I've started getting it removed. Will take years."


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