Exemplo n.º 1
0
    static bool CloseAttack(gamebook.Scenario SC, spells.SpellDesc S)
    {
        //{This spell zaps something, just like a melee attack.}
        rpgtext.DCAppendMessage("Direction?");

        //{Select a direction. Make sure an appropriate direction was chosen.}
        int  D;
        bool success = int.TryParse(rpgtext.RPGKey().ToString(), out D);

        if (!success || D == 5)
        {
            return(false);
        }

        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.HitRoll  = S.p1;
        AR.Damage   = S.step;
        AR.Range    = -1;
        AR.Attacker = SC.PC.m;
        AR.TX       = SC.PC.m.x + texmaps.VecDir[D - 1, 0];
        AR.TY       = SC.PC.m.y + texmaps.VecDir[D - 1, 1];
        AR.DF       = gamebook.DF_Mystic;
        AR.C        = S.c;
        AR.ATT      = S.ATT;
        AR.Desc     = S.cdesc;

        dccombat.ProcessAttack(SC, AR);

        return(true);
    }
Exemplo n.º 2
0
    static bool ShootAttack(gamebook.Scenario SC, spells.SpellDesc S)
    {
        //{This spell shoots something, just like a missile attack.}
        rpgtext.DCAppendMessage("Select Target: ");
        texmaps.Point TP = looker.SelectPoint(SC, true, true, SC.PC.target);

        //{Check to make sure a target was selected, and also}
        //{the the player isn't trying to shoot himself.}
        if (TP.x == -1)
        {
            return(false);
        }

        if (TP.x == SC.PC.m.x && TP.y == SC.PC.m.y)
        {
            return(false);
        }

        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.HitRoll  = S.p1;
        AR.Damage   = S.step;
        AR.Range    = S.p2;
        AR.Attacker = SC.PC.m;
        AR.TX       = TP.x;
        AR.TY       = TP.y;
        AR.DF       = gamebook.DF_Mystic;
        AR.C        = S.c;
        AR.ATT      = S.ATT;
        AR.Desc     = S.cdesc;

        dccombat.ProcessAttack(SC, AR);

        return(true);
    }
Exemplo n.º 3
0
    static void CritterAttack(gamebook.Scenario SC, critters.Critter C, int TX, int TY)
    {
        /*Critter C wants to attack whatever is in square TX,TY.*/

        /*Fill out the Attack Request.*/
        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.Attacker = C.M;
        AR.TX       = TX;
        AR.TY       = TY;
        AR.DF       = gamebook.DF_Physical;
        AR.C        = Crt.Color.LightRed;

        /*Fill out the rest of the data dep}ant upon what equipment*/
        /*the creature is using.*/
        if (C.Eqp != null && C.Eqp.ikind == dcitems.IKIND_Gun)
        {
            AR.HitRoll = critters.MonMan[C.crit - 1].HitRoll + dcitems.CGuns[C.Eqp.icode - 1].ACC;
            AR.Damage  = dcitems.CGuns[C.Eqp.icode - 1].DMG;
            AR.Range   = dcitems.CGuns[C.Eqp.icode - 1].RNG;
            AR.ATT     = dcitems.CGuns[C.Eqp.icode - 1].ATT;

            if (AR.ATT.Contains(spells.AA_LineAttack))
            {
                AR.Desc = "fires " + dcitems.ItemNameShort(C.Eqp);
            }
            else
            {
                AR.Desc = "fires " + dcitems.ItemNameShort(C.Eqp) + " at";
            }
        }
        else if (C.Eqp != null && C.Eqp.ikind == dcitems.IKIND_Wep)
        {
            AR.HitRoll = critters.MonMan[C.crit - 1].HitRoll + dcitems.CWep[C.Eqp.icode - 1].ACC;
            AR.Damage  = critters.MonMan[C.crit - 1].Damage + dcitems.CWep[C.Eqp.icode - 1].DMG;
            AR.Range   = -1;
            AR.Desc    = "swings " + dcitems.ItemNameShort(C.Eqp) + " at";
            AR.ATT     = dcitems.CWep[C.Eqp.icode - 1].ATT;
        }
        else
        {
            AR.HitRoll = critters.MonMan[C.crit - 1].HitRoll;
            AR.Damage  = critters.MonMan[C.crit - 1].Damage;
            AR.Range   = critters.MonMan[C.crit - 1].Range;
            AR.Desc    = critters.MonMan[C.crit - 1].ADesc;
            AR.ATT     = critters.MonMan[C.crit - 1].AtAt;
        }

        /*Process the attack. If a fatality is inflicted on the*/
        /*critter's target, the Excommunicate static void will reset*/
        /*the target field to null.*/
        dccombat.ProcessAttack(SC, AR);
    }
Exemplo n.º 4
0
    /*This unit contains procedures which define the various*/
    /*actions that the PC can take.*/

    /*Most of these routines are boolean functions. A value*/
    /*of TRUE implies that the PC has taken some action;*/
    /*advance the time counter and let the monsters have their*/
    /*turn. A value of FALSE is for cancelled actions or game*/
    /*options; it doesn't use the PC's action.*/

    public static void PCMeleeAttack(gamebook.Scenario SC, int TX, int TY)
    {
        /*This procedure allows the PC to attack something with the*/
        /*equipped close combat weapon.*/

        /*Note that a person making melee attacks will burn up calories*/
        /*far more quickly than normal. But, it won't make you starve.*/
        if (SC.PC.carbs > 10)
        {
            SC.PC.carbs -= 1;
        }

        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.HitRoll  = dcchars.PCMeleeSkill(SC.PC);
        AR.Damage   = dcchars.PCMeleeDamage(SC.PC);
        AR.Range    = -1;
        AR.Attacker = SC.PC.m;
        AR.TX       = TX;
        AR.TY       = TY;
        AR.DF       = gamebook.DF_Physical;
        AR.C        = Crt.Color.LightRed;
        AR.ATT      = "";

        /*Generate the description for the PC's attack.*/
        if (SC.PC.eqp[dcchars.ES_MeleeWeapon - 1] == null)
        {
            if (rpgdice.Random(99) == 69)
            {
                AR.Desc = "bite";
            }
            else if (rpgdice.Random(3) == 2)
            {
                AR.Desc = "kick";
            }
            else
            {
                AR.Desc = "punch";
            }
        }
        else
        {
            AR.Desc = "swing " + dcitems.ItemNameShort(SC.PC.eqp[dcchars.ES_MeleeWeapon - 1]) + " at";
            AR.ATT  = dcitems.CWep[SC.PC.eqp[dcchars.ES_MeleeWeapon - 1].icode - 1].ATT;
        }

        dccombat.ProcessAttack(SC, AR);
    }
Exemplo n.º 5
0
    public static bool PCTosser(gamebook.Scenario SC)
    {
        /*The PC wants to throw a grenade.*/
        /*The majority of this unit was simply copied from above.*/

        /*Select a grenade to toss.*/
        dcitems.DCItem Grn = backpack.PromptItem(SC, dcitems.IKIND_Grenade);
        if (Grn == null)
        {
            return(false);
        }

        /*Start the standard firing stuff.*/
        rpgtext.DCGameMessage("Throw grenade - Select Target: ");
        texmaps.Point TP = looker.SelectPoint(SC, true, true, SC.PC.target);

        /*Check to make sure a target was selected, and also*/
        /*the the player isn't trying to shoot himself.*/
        if (TP.x == -1)
        {
            return(false);
        }
        if (TP.x == SC.PC.m.x && TP.y == SC.PC.m.y)
        {
            return(false);
        }

        /*Check to make sure the target point is within the PC's*/
        /*maximum throwing range.*/
        if (texmaps.Range(SC.PC.m, TP.x, TP.y) > dcchars.PCThrowRange(SC.PC))
        {
            rpgtext.DCPointMessage("Out of range!");
            return(false);
        }

        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.HitRoll  = dcchars.PCThrowSkill(SC.PC);
        AR.Damage   = dcitems.CGrn[Grn.icode - 1].DMG;
        AR.Range    = dcitems.CGrn[Grn.icode - 1].DMG;
        AR.Attacker = SC.PC.m;
        AR.TX       = TP.x;
        AR.TY       = TP.y;
        AR.DF       = gamebook.DF_Physical;
        AR.C        = Crt.Color.Yellow;
        AR.ATT      = dcitems.CGrn[Grn.icode].ATT;
        if (AR.ATT.Contains(spells.AA_LineAttack) || AR.ATT.Contains(spells.AA_BlastAttack) || AR.ATT.Contains(spells.AA_SmokeAttack))
        {
            AR.Desc = "throw " + dcitems.ItemNameShort(Grn);
        }
        else
        {
            AR.Desc = "throw " + dcitems.ItemNameShort(Grn) + " at";
        }

        dccombat.AttackReport Rep = dccombat.ProcessAttack(SC, AR);

        /*Consume the grenade.*/
        dcitems.ConsumeDCItem(ref SC.PC.inv, Grn, 1);

        return(true);
    }
Exemplo n.º 6
0
    public static bool PCShooting(gamebook.Scenario SC, bool SeekModel)
    {
        /*The player wants to shoot something. Select a target and*/
        /*let fly!*/


        /*Error check- make sure the PC has a missile weapon equipped!*/
        if (SC.PC.eqp[dcchars.ES_MissileWeapon - 1] == null)
        {
            rpgtext.DCGameMessage("No missile weapon equipped!");
            return(false);
        }
        else if (SC.PC.eqp[dcchars.ES_MissileWeapon - 1].charge == 0)
        {
            rpgtext.DCGameMessage("Out of ammo!");
            return(false);
        }

        rpgtext.DCGameMessage("Targeting - Select Target: ");
        texmaps.Point TP = looker.SelectPoint(SC, true, SeekModel, SC.PC.target);

        /*Check to make sure a target was selected, and also*/
        /*the the player isn't trying to shoot himself.*/
        if (TP.x == -1)
        {
            return(false);
        }
        if (TP.x == SC.PC.m.x && TP.y == SC.PC.m.y)
        {
            return(false);
        }

        dccombat.AttackRequest AR = new dccombat.AttackRequest();
        AR.HitRoll  = dcchars.PCMissileSkill(SC.PC);
        AR.Damage   = dcchars.PCMissileDamage(SC.PC);
        AR.Range    = dcchars.PCMissileRange(SC.PC);
        AR.Attacker = SC.PC.m;
        AR.TX       = TP.x;
        AR.TY       = TP.y;
        AR.DF       = gamebook.DF_Physical;
        AR.C        = Crt.Color.LightRed;
        if (SC.PC.eqp[dcchars.ES_MissileWeapon - 1].state != 0)
        {
            /*If special ammunition is being used, add its attack attributes to the string.*/
            AR.Damage = AR.Damage + dcitems.CSpecAmmo[Math.Abs(SC.PC.eqp[dcchars.ES_MissileWeapon - 1].state) - 1].DMG;
            if (AR.Damage < 1)
            {
                AR.Damage = 1;
            }
            AR.HitRoll = AR.HitRoll + dcitems.CSpecAmmo[Math.Abs(SC.PC.eqp[dcchars.ES_MissileWeapon - 1].state) - 1].ACC;
            if (AR.HitRoll < 1)
            {
                AR.HitRoll = 1;
            }
            AR.ATT = dcitems.CSpecAmmo[Math.Abs(SC.PC.eqp[dcchars.ES_MissileWeapon - 1].state) - 1].ATT + dcitems.CGuns[SC.PC.eqp[dcchars.ES_MissileWeapon - 1].icode - 1].ATT;
        }
        else
        {
            AR.ATT = dcitems.CGuns[SC.PC.eqp[dcchars.ES_MissileWeapon - 1].icode - 1].ATT;
        }
        if (AR.ATT.Contains(spells.AA_LineAttack) || AR.ATT.Contains(spells.AA_BlastAttack) || AR.ATT.Contains(spells.AA_SmokeAttack))
        {
            AR.Desc = "fire " + dcitems.ItemNameShort(SC.PC.eqp[dcchars.ES_MissileWeapon - 1]);
        }
        else
        {
            AR.Desc = "fire " + dcitems.ItemNameShort(SC.PC.eqp[dcchars.ES_MissileWeapon - 1]) + " at";
        }

        dccombat.AttackReport Rep = dccombat.ProcessAttack(SC, AR);

        /*Reduce the weapon's AMMO count, unless using infinite shot weapon.*/
        if (SC.PC.eqp[dcchars.ES_MissileWeapon - 1].charge > -1)
        {
            SC.PC.eqp[dcchars.ES_MissileWeapon - 1].charge -= 1;
        }

        return(true);
    }