Exemple #1
0
    /// <summary>
    /// 奏でる
    /// </summary>
    public override bool Melody(ManageDungeon dun, PlayerCharacter player)
    {
        BaseCharacter[] targets;

        player.AttackInfo.Initialize();

        //音を鳴らす
        player.AttackInfo.AddVoice(VoiceInformation.VoiceType.Sing);

        switch (MType)
        {
        //放電
        case MelodyType.Electric:

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.ElectricMelody);

            const int ElectricDamage = 20;
            int       damage         = ElectricDamage + Mathf.FloorToInt(player.BaseAttack);

            //エフェクト
            player.AttackInfo.AddEffect(EffectSpark.CreateObject(player));

            //メッセージ
            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            //部屋の中のキャラクターを取得
            targets = dun.GetRoomCharacters(player);

            //全員にダメージ
            foreach (BaseCharacter c in targets)
            {
                AttackState atState = c.AddDamage(damage);

                //ダメージエフェクト
                EffectDamage d = EffectDamage.CreateObject(c);
                d.SetText(damage.ToString(), AttackState.Hit);
                player.AttackInfo.AddEffect(d);

                //ヒットメッセージ
                player.AttackInfo.AddMessage(
                    c.GetMessageAttackHit(damage));

                //対象が死亡したら
                if (atState == AttackState.Death)
                {
                    player.AttackInfo.AddKillList(c);

                    player.AttackInfo.AddMessage(
                        c.GetMessageDeath(c.HaveExperience));

                    player.Death(c, player.AttackInfo);
                }
            }


            break;

        //狂乱
        case MelodyType.Confusion:

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.Smoke);

            //メッセージ
            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            //部屋の中のキャラクターを取得
            targets = dun.GetRoomCharacters(player);

            //全員を混乱
            foreach (BaseCharacter c in targets)
            {
                //対象に混乱を付与
                int result = c.AddStateAbnormal((int)StateAbnormal.Confusion);
                //対象が混乱になったらメッセージを表示
                if (result != 0)
                {
                    player.AttackInfo.AddEffect(EffectSmoke.CreateObject(c));

                    player.AttackInfo.AddMessage(
                        CommonFunction.GetAbnormalMessage(StateAbnormal.Confusion, c));
                }
            }
            break;

        //まどろみ
        case MelodyType.Sleep:

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.Smoke);

            //メッセージ
            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            //部屋の中のキャラクターを取得
            targets = dun.GetRoomCharacters(player);

            //全員を睡眠
            foreach (BaseCharacter c in targets)
            {
                //対象に睡眠を付与
                int result = c.AddStateAbnormal((int)StateAbnormal.Sleep);
                //対象が睡眠になったらメッセージを表示
                if (result != 0)
                {
                    player.AttackInfo.AddEffect(EffectSmoke.CreateObject(c));

                    player.AttackInfo.AddMessage(
                        CommonFunction.GetAbnormalMessage(StateAbnormal.Sleep, c));
                }
            }
            break;

        //無秩序
        case MelodyType.Anarchy:

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.Smoke);

            //メッセージ
            player.AttackInfo.AddMessage(string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            //部屋の中のキャラクターを取得
            targets = dun.GetRoomCharacters(player);

            //全員をデコイ
            foreach (BaseCharacter c in targets)
            {
                //対象にデコイを付与
                int result = c.AddStateAbnormal((int)StateAbnormal.Decoy);
                //対象がデコイになったらメッセージを表示
                if (result != 0)
                {
                    player.AttackInfo.AddEffect(EffectSmoke.CreateObject(c));

                    player.AttackInfo.AddMessage(
                        CommonFunction.GetAbnormalMessage(StateAbnormal.Decoy, c));
                }
            }
            break;

        //薄ら日
        case MelodyType.Light:

            //エフェクト
            player.AttackInfo.AddEffect(EffectFlash.CreateObject());

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.Smoke);

            //メッセージ
            player.AttackInfo.AddMessage(string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            dun.IsVisible      = true;
            dun.IsEnemyVisible = true;
            dun.IsItemVisible  = true;
            dun.IsTrapVisible  = true;
            break;

        //角笛
        case MelodyType.Horn:

            //サウンドを鳴らす
            player.AttackInfo.AddSound(SoundInformation.SoundType.Summon);

            //エフェクトの発動
            player.AttackInfo.AddEffect(EffectSummon.CreateObject(player));

            int cnt = CommonFunction.ConvergenceRandom(3, 0.9f, 1.2f, 10);

            for (int i = 0; i < cnt; i++)
            {
                dun.SetUpCharacterMap();
                //敵の出現地点を取得
                MapPoint mp = dun.GetCharacterEmptyTarget(player.CurrentPoint);
                if (CommonFunction.IsNull(mp) == true)
                {
                    break;
                }

                int  enemytype           = TableEnemyMap.GetValue(dun.DungeonObjNo, DisplayInformation.Info.Floor);
                uint rand                = CommonFunction.GetRandomUInt32();
                BaseEnemyCharacter enemy = TableEnemyIncidence.GetEnemy(enemytype, rand, DisplayInformation.Info.Floor);

                enemy.SetCharacterDisplayObject(mp.X, mp.Y);
                dun.AddNewCharacter(enemy);
            }
            DisplayInformation.Info.AddMessage(
                CommonConst.Message.TrapSummon);

            break;

        // 忘却
        case MelodyType.Forget:

            //メッセージ
            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            //効果音
            player.AttackInfo.AddSound(SoundInformation.SoundType.Summon);

            if (dun.IsVisible == false)
            {
                for (int j = 1; j < dun.X - 1; j++)
                {
                    for (int i = 1; i < dun.Y - 1; i++)
                    {
                        dun.Dungeon.DungeonMap.Get(i, j).IsClear = false;
                    }
                }

                player.AttackInfo.AddMessage(CommonConst.Message.ForgetMap);

                player.AttackInfo.AddEffect(EffectSmoke.CreateObject(player));
            }

            break;

        //捨て置き
        case MelodyType.ThrowAway:

            //メッセージ
            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.MelodySing, DisplayNameInMessage));

            player.AttackInfo.AddMessage(
                string.Format(CommonConst.Message.ThrowAway, player.DisplayNameInMessage));

            GameStateInformation.Info.IsThrowAway = true;

            break;
        }
        return(true);
    }
Exemple #2
0
    public bool Invocate(ManageDungeon dun)
    {
        if (IsInvocation == false)
        {
            return(false);
        }
        IsActive     = true;
        IsInvocation = false;
        int bresult;

        //オプションによるトラップ回避
        float t = 0;

        foreach (BaseOption o in Target.Options)
        {
            t += o.DexTrap();
        }

        if (CommonFunction.IsRandom(t) == true)
        {
            DisplayInformation.Info.AddMessage(CommonConst.Message.DexTrap);
            Target = null;
            return(false);
        }

        //スコア値の更新
        DungeonHistoryInformation.Info.iTrapInvokeCount++;

        //サウンドを鳴らす
        if (Target.Type == ObjectType.Player)
        {
            VoiceInformation.Voice.Play(PlayerInformation.Info.PType, VoiceInformation.Voice.PlayRandomDefence());
        }

        bool result = false;

        //効果発動
        switch (TType)
        {
        case TrapType.Bomb:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Bomb);

            //エフェクトの発動
            EffectBigBang.CreateObject(this).Play();

            //ダメージ処理
            int         damage  = Mathf.CeilToInt(Target.CurrentHp / PerPlayerDamage);
            AttackState atState = Target.AddDamage(damage);

            //プレイヤーが死亡したら
            if (atState == AttackState.Death)
            {
                DisplayInformation.Info.AddMessage(
                    Target.GetMessageDeath(Target.HaveExperience));

                ScoreInformation.Info.CauseDeath =
                    string.Format(CommonConst.DeathMessage.Trap, DisplayNameNormal);
                ScoreInformation.Info.CauseDeathType = DeathCouseType.Trap;

                Target.Death();
                Target.DeathAction(dun);
            }


            //ダメージエフェクト
            EffectDamage d = EffectDamage.CreateObject(Target);
            d.SetText(damage.ToString(), AttackState.Hit);
            d.Play();

            //ヒットメッセージ
            DisplayInformation.Info.AddMessage(
                Target.GetMessageAttackHit(damage));

            //周辺キャラのダメージ処理
            dun.SetUpCharacterMap();
            List <BaseCharacter> list = dun.GetNearCharacters(this.CurrentPoint, 1);
            foreach (BaseCharacter c in list)
            {
                atState = c.AddDamage(CommonNumber);
                EffectDamage d2 = EffectDamage.CreateObject(c);
                d2.SetText(CommonNumber.ToString(), AttackState.Hit);
                d2.Play();

                //対象が死亡したら
                if (atState == AttackState.Death)
                {
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.DeathCommon, c.DisplayNameInMessage));

                    c.Death();
                    c.DeathAction(dun);
                }
            }
            result = true;
            break;

        case TrapType.ColorMonitor:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectColorMonitor.CreateObject(this).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.StiffShoulder);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.StiffShoulder, Target));
            }
            result = true;
            break;

        case TrapType.Cyclone:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Cyclone);

            //エフェクトの発動
            EffectCyclone.CreateObject(Target).Play();

            //メッセージの出力
            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.TrapCyclone2, Target.DisplayNameInMessage));

            //効果

            result = true;
            break;

        case TrapType.Electric:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.ElectricTrap);

            //エフェクトの発動
            EffectThunder.CreateObject(Target).Play();

            BaseItem[] equips = PlayerCharacter.ItemList.FindAll(i => i.IsEquip == true).ToArray();

            if (equips.Length > 0)
            {
                foreach (BaseItem i in equips)
                {
                    i.ForceRemoveEquip(Target);
                }

                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.TrapEquipRemove, Target.DisplayNameInMessage));
            }

            result = true;
            break;

        case TrapType.Mud:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectBadSmoke.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Slow);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Slow, Target));
            }
            result = true;
            break;

        case TrapType.Palalysis:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectBadSmoke.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Palalysis);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Palalysis, Target));
            }
            result = true;
            break;

        case TrapType.Photo:
            if (Target.Type == ObjectType.Player)
            {
                //サウンドを鳴らす
                SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

                //エフェクトの発動
                EffectBadSmoke.CreateObject(Target).Play();

                //メッセージの出力
                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.TrapCroquette2, Target.DisplayNameInMessage));

                ((PlayerCharacter)Target).ReduceSatiety(CommonNumber);
                result = true;
            }
            break;

        case TrapType.Poison:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectBadSmoke.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Poison);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Poison, Target));
            }

            result = true;
            break;

        case TrapType.DeadlyPoison:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectBadSmoke.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.DeadlyPoison);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.DeadlyPoison, Target));
            }

            result = true;
            break;

        case TrapType.Rotation:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Rotation);

            //エフェクトの発動
            EffectRotation.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Confusion);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                EffectSmoke.CreateObject(Target);
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Confusion, Target));
            }


            result = true;
            break;

        case TrapType.SandStorm:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Cyclone);

            //エフェクトの発動
            EffectSandStorm.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Dark);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Dark, Target));
            }
            result = true;
            break;

        case TrapType.Song:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectBadSmoke.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Sleep);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Sleep, Target));
            }
            result = true;
            break;

        case TrapType.Summon:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Summon);

            //エフェクトの発動
            EffectSummon.CreateObject(Target).Play();

            int cnt = CommonFunction.ConvergenceRandom(CountStart, ProbStart, ProbReduce);

            for (int i = 0; i < cnt; i++)
            {
                dun.SetUpCharacterMap();
                //敵の出現地点を取得
                MapPoint mp = dun.GetCharacterEmptyTarget(Target.CurrentPoint);
                if (CommonFunction.IsNull(mp) == true)
                {
                    break;
                }

                int  enemytype           = TableEnemyMap.GetValue(dun.DungeonObjNo, DisplayInformation.Info.Floor);
                uint rand                = CommonFunction.GetRandomUInt32();
                BaseEnemyCharacter enemy = TableEnemyIncidence.GetEnemy(enemytype, rand, DisplayInformation.Info.Floor);

                enemy.SetCharacterDisplayObject(mp.X, mp.Y);
                dun.AddNewCharacter(enemy);
            }
            DisplayInformation.Info.AddMessage(
                CommonConst.Message.TrapSummon);

            result = true;
            break;

        case TrapType.TheFly:

            if (Target.Type == ObjectType.Player)
            {
                //サウンドを鳴らす
                SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

                //エフェクトの発動
                EffectBadSmoke.CreateObject(Target).Play();

                BaseItem[] foods = PlayerCharacter.ItemList.FindAll(i => i.IType == ItemType.Food).ToArray();

                if (foods.Length > 0)
                {
                    foreach (BaseItem i in foods)
                    {
                        PlayerCharacter.RemoveItem(i);
                        ((PlayerCharacter)Target).AddItem(TableFood.GetItem(CommonConst.ObjNo.FlyCroquette), i.SortNo);
                    }

                    //メッセージの出力
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.TrapFly2));
                }

                result = true;
            }
            break;

        case TrapType.WaterBucket:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.BucketFall);

            //エフェクトの発動
            EffectWaterBucket.CreateObject(Target).Play();

            //効果
            bresult = Target.AddStateAbnormal((int)StateAbnormal.Reticent);
            //対象が異常になったらメッセージを表示
            if (bresult != 0)
            {
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Reticent, Target));
            }

            result = true;
            break;

        //花粉
        case TrapType.Pollen:

            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);

            //エフェクトの発動
            EffectSmoke d3 = EffectSmoke.CreateObject(Target);
            d3.SetColor(Color.yellow);
            d3.Play();

            //力減少
            Target.ReducePower((ushort)CommonNumber);

            //メッセージの出力
            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.TrapPllen2, Target.DisplayNameInMessage));

            result = true;
            break;

        case TrapType.Ember:

            //ダメージ処理
            int damage2 = CommonNumber;

            //通常ダメージの場合
            if (CommonFunction.HasOptionType(this.Options, OptionType.ReverceDamage) == false)
            {
                AttackState atState2 = Target.AddDamage(damage2);

                //ダメージエフェクト
                EffectDamage d4 = EffectDamage.CreateObject(Target);
                d4.SetText(damage2.ToString(), AttackState.Hit);
                d4.Play();

                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.TrapDamage, Target.DisplayNameInMessage, this.DisplayNameInMessage, damage2));

                //対象が死亡したら
                if (atState2 == AttackState.Death)
                {
                    DisplayInformation.Info.AddMessage(
                        Target.GetMessageDeath(Target.HaveExperience));

                    if (Target.Type == ObjectType.Player)
                    {
                        ScoreInformation.Info.CauseDeath =
                            string.Format(CommonConst.DeathMessage.Trap, DisplayNameNormal);
                        ScoreInformation.Info.CauseDeathType = DeathCouseType.Trap;
                    }
                    Target.Death();
                    Target.DeathAction(dun);
                }
            }
            //反転回復の場合
            else
            {
                Target.RecoverHp(damage2);

                //ダメージエフェクト
                EffectDamage d4 = EffectDamage.CreateObject(Target);
                d4.SetText(damage2.ToString(), AttackState.Heal);
                d4.Play();


                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.TrapRecover, Target.DisplayNameInMessage, this.DisplayNameInMessage, damage2));
            }
            break;
        }
        Target = null;

        return(result);
    }