Exemple #1
0
        private static bool Dodge(DMEnv env, Investigator inv)
        {
            FightEvent fight = inv.PeekNextFight(env.Sce, out Investigator source, out Item oppositeWeapon);

            if (oppositeWeapon.Type == "射击")
            {
                env.Next = oppositeWeapon + "是射击武器,仅肉搏或投掷武器可闪避!";
                return(false);
            }

            if (!inv.Check("闪避", out CheckResult result, out string str))
            {
                env.Next = str;
                return(false);
            }
            inv.Fights.Dequeue();

            env.AppendLine(str);
            env.Save();
            if (result.succeed && result.type <= fight.ResultType)
            {
                env.Append($"躲开了{fight}!");
                return(true);
            }
            else
            {
                env.AppendLine($"受到了{fight}");
                CalculateDamage(env, source, inv, fight.WeaponName);
                return(false);
            }
        }
Exemple #2
0
        private static bool FightBack(DMEnv env, Investigator target, string weaponName)
        {
            Item       selfWeapon = target.GetItem(weaponName);
            FightEvent fight      = target.PeekNextFight(env.Sce, out Investigator source, out Item oppositeWeapon);

            if (oppositeWeapon.Type != "肉搏")
            {
                env.Next = oppositeWeapon + "不是肉搏武器,仅肉搏可反击!";
                return(false);
            }

            if (!target.Check(oppositeWeapon.SkillName, out CheckResult result, out string str))
            {
                env.Next = str;
                return(false);
            }

            target.Fights.Dequeue();

            env.AppendLine(str);
            if (result.succeed && result.type < fight.ResultType)
            {
                int mulfunctionCheckResult = Dice.Roll(100);
                if (mulfunctionCheckResult > selfWeapon.Mulfunction)
                {
                    env.Append($"{target.Name}的{selfWeapon.Name}{(selfWeapon.Type == "射击" ? "炸膛" : "坏掉")}了!({mulfunctionCheckResult} > {selfWeapon.Mulfunction})");
                    return(false);
                }
                env.Append($"反击了{fight}!");
                CalculateDamage(env, target, source, weaponName);
            }
            else
            {
                env.Append($"受到了{fight}!");
                CalculateDamage(env, source, target, fight.WeaponName);
            }
            return(true);
        }