CW Network

Yukio! Less bugs, DS bug still here, 0% stays 0%
Page 1 of 1

Author:  Captain Vimes [ Fri Jan 05, 2007 10:27 am ]
Post subject:  Yukio! Less bugs, DS bug still here, 0% stays 0%

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!

 *Author: Albert Lai
 *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{
    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; = 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());
            if(defender instanceof Stealth && defender.dived)baseDamage = ((Stealth)defender).getHiddenDamage(attacker.getUType());
            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)));
            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;
        //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.
            return (int)((tdef*30)+100*((store+5)/store));
            return (int)(100*((store+5)/store));
            store = 100*((store+5)/store);
            return (int)(store);
            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(index == 15)

Page 1 of 1 All times are UTC + 9:30 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group