Exemple #1
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);
    }
Exemple #2
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);
    }