public static EffectShieldThrow CreateObject(BaseCharacter target, BaseCharacter attacker, string damage, AttackState at)
    {
        //var obj = GameObject.Instantiate(ResourceInformation.Effect.transform.FindChild("Stone").gameObject);
        //obj.transform.SetParent(ResourceInformation.Effect.transform, false);
        //EffectStoneThrow d = obj.AddComponent<EffectStoneThrow>();
        //d.Parent = obj;
        EffectShieldThrow d = GetGameObject <EffectShieldThrow>(false, "EffectShield", ResourceInformation.Effect.transform);

        d.Direction = attacker.Direction;
        d.isDirect  = true;
        d.wait      = 5;

        d.eDamage = EffectDamage.CreateObject(target);
        d.eDamage.SetText(damage, at);

        //目標位置の取得
        d.TargetPoint = new Vector3(target.CurrentPoint.X * target.PositionUnit,
                                    attacker.PosY,
                                    target.CurrentPoint.Y * target.PositionUnit);

        //現在位置の取得
        Vector3 v = new Vector3(attacker.CurrentPoint.X * attacker.PositionUnit,
                                attacker.PosY,
                                attacker.CurrentPoint.Y * attacker.PositionUnit);

        //戻り位置の取得
        d.ReturnPoint = new Vector3(attacker.CurrentPoint.X * attacker.PositionUnit,
                                    attacker.PosY,
                                    attacker.CurrentPoint.Y * attacker.PositionUnit);


        d.Parent.transform.localPosition = v;

        return(d);
    }
    public virtual void AttackEffect(BaseCharacter target, BaseCharacter attacker, string damage, AttackState state, AttackInformation atinfo)
    {
        EffectDamage d = EffectDamage.CreateObject(target);

        d.SetText(damage, state);
        atinfo.AddEffect(d);
    }
Example #3
0
    internal override AEffect Compute(AttackInfos a_attackInfos)
    {
        EffectDamage dmg = new EffectDamage();

        dmg.attackInfos = a_attackInfos;

        IntModifier damageFromStats = a_attackInfos.source.attack.GetBonusDamage(type);
        IntModifier arpenFromStats  = a_attackInfos.source.attack.GetPenetration(type);

        if (canCrit && a_attackInfos.critType == ECriticalType.Crititcal)
        {
            damageFromStats.Add(a_attackInfos.source.attack.CriticalDamages);
            arpenFromStats.Add(a_attackInfos.source.attack.CriticalArpen);
        }
        else if (canCrit && a_attackInfos.critType == ECriticalType.Penetration)
        {
            damageFromStats.Add(a_attackInfos.source.attack.PenetrationDamages);
            arpenFromStats.Add(a_attackInfos.source.attack.PenetrationArpen);
        }

        dmg.amount = baseAmount.Value;
        dmg.amount = damageFromStats.Compute(dmg.amount, FFEngine.Game.Constants.DAMAGE_BONUS_IS_FLAT_FIRST);
        dmg.arpen  = arpenFromStats;

        dmg.type = type;

        return(dmg);
    }
Example #4
0
 public DamageTypeEffect(EffectDamage damageType, UnitStats targetStats, CharacterStats ownerStats, float amplificationAmount)
 {
     if (damageType is FireDamage)
     {
         new StatusEffectFactory <Burn>(targetStats, ownerStats, amplificationAmount);
     }
     else if (damageType is IceDamage)
     {
         new StatusEffectFactory <Freeze>(targetStats, ownerStats, amplificationAmount);
     }
 }
Example #5
0
    /// <summary>
    /// 投げる効果(誰かに当たった時)
    /// </summary>
    public virtual bool ThrowAction(ManageDungeon dun, PlayerCharacter player, BaseCharacter target)
    {
        if (CommonFunction.IsRandom(ThrowDexterity) == true)
        {
            //あたりメッセージ
            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.HitThrowAfter, target.DisplayNameInMessage));

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

            int         damage  = Mathf.CeilToInt((ItemAttack + ItemDefence + StrengthValue) * 2);
            AttackState atState = target.AddDamage(damage);

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

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

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

                if (target.Type == ObjectType.Player)
                {
                    ScoreInformation.Info.CauseDeath =
                        string.Format(CommonConst.DeathMessage.Throw, DisplayNameNormal);
                    ScoreInformation.Info.CauseDeathType = DeathCouseType.Throw;
                }

                player.Death(target, player.AttackInfo);
                target.DeathAction(dun);
            }

            IsThrowBreak = true;

            return(true);
        }
        else
        {
            //サウンドを鳴らす
            SoundInformation.Sound.Play(SoundInformation.SoundType.Put);

            DisplayInformation.Info.AddMessage(string.Format(CommonConst.Message.AttackMissPlayer, target.DisplayNameInMessage));
            DisplayInformation.Info.AddMessage(string.Format(CommonConst.Message.DropItem, this.DisplayNameInMessage));
            return(false);
        }
    }
Example #6
0
    internal bool ShouldScratch(EffectDamage a_dmg)
    {
        float rand = Random.value * 100f;
        int   armorAfterReduction = a_dmg.arpen.Compute(GetResistance(a_dmg.type).armor, FFEngine.Game.Constants.ARMOR_REDUCTION_FROM_ARPEN_IS_FLAT_FIRST);

        if (rand < Mathf.Clamp(armorAfterReduction, 0f, 100f))
        {
            return(true);
        }

        return(false);
    }
Example #7
0
    public static EffectDamage CreateObject(BaseCharacter t)
    {
        //var obj = GameObject.Instantiate(ResourceInformation.EffectCanvas.transform.FindChild("Damage/DamageText").gameObject);
        //obj.transform.SetParent(ResourceInformation.EffectCanvas.transform, false);
        //EffectDamage d = obj.AddComponent<EffectDamage>();
        //d.Parent = obj;
        EffectDamage d = GetGameObject <EffectDamage>(false, "Damage/DamageText", ResourceInformation.EffectCanvas.transform, true);

        Vector3 v;

        if (CommonFunction.IsNullUnity(t.ThisDisplayObject) == false)
        {
            if (GameStateInformation.Info.IsDark == false)
            {
                v = new Vector3(t.ThisTransform.position.x,
                                t.ThisTransform.position.y,
                                t.ThisTransform.position.z);
            }
            else
            {
                ResourceInformation.DammyObject.transform.localPosition = new Vector3(t.ThisTransform.localPosition.x,
                                                                                      t.OriginalPosY,
                                                                                      t.ThisTransform.localPosition.z
                                                                                      );
                v = new Vector3(ResourceInformation.DammyObject.transform.position.x,
                                ResourceInformation.DammyObject.transform.position.y,
                                ResourceInformation.DammyObject.transform.position.z
                                );
            }
        }
        //通常入らない。保険
        else
        {
            v = Vector3.zero;
        }


        d.Parent.GetComponent <RectTransform>().position = RectTransformUtility.WorldToScreenPoint(Camera.main,
                                                                                                   v);

        //発射位置を多少ずらすS
        float locy = (float)UnityEngine.Random.Range(-100, 100) / 10;
        float locx = (float)UnityEngine.Random.Range(-100, 100) / 10;
        float locz = (float)UnityEngine.Random.Range(-100, 100) / 10;

        //d.Parent.transform.localPosition += new Vector3(locx, locy + 30, locz);
        d.Parent.transform.Translate(locx, locy + 30, locz, Space.World);
        return(d);
    }
    /// <summary>
    /// ダメージ効果の変換
    /// </summary>
    /// <param name="dun"></param>
    /// <param name="attacker"></param>
    /// <param name="target"></param>
    /// <param name="damage"></param>
    /// <returns></returns>
    public void DamageAttackEffect(BaseCharacter attacker, BaseCharacter target, int damage)
    {
        switch (OType)
        {
        //攻撃吸収
        case OptionType.AttackRecover:
            int rcv = Mathf.CeilToInt((damage * CommonFloat) * Plus);
            attacker.RecoverHp(rcv);
            EffectDamage d = EffectDamage.CreateObject(attacker);
            d.SetText(rcv.ToString(), AttackState.Heal);
            d.Play();

            break;
        }
    }
 private void Update()
 {
     if (time > wait)
     {
         //終了
         EffectDamage d = EffectDamage.CreateObject(Target);
         Target = null;
         d.SetText(Damage, atst);
         d.Play();
         End();
     }
     else if (time % interval == 0)
     {
         EffectGunFIreSub.CreateObject(current, TargetPoint, this.Direction).Play();
     }
     time++;
 }
Example #10
0
    public static BaseEffect Create(string type, BaseUnit caster, BaseUnit source, BaseUnit target)
    {
        BaseEffect effect = null;

        switch (type)
        {
        case EffectType.EffectProjectile:
            effect = new EffectProjectile();
            break;

        case EffectType.EffectDamage:
            effect = new EffectDamage();
            break;

        default:
            effect = new BaseEffect();
            break;
        }
        return(effect);
    }
Example #11
0
        public override SkillEffect[] CreateEffects(int param)
        {
            int count = 1;

            if (hitEnemyDamage > 0)
            {
                count++;
            }

            SkillEffect[] effects = new SkillEffect[count];
            effects[0] = new EffectPushaway(50);

            if (hitEnemyDamage > 0)
            {
                if (!areaDamage)
                {
                    effects[1] = new EffectDamage(hitEnemyDamage);
                }
            }

            return(effects);
        }
    /// <summary>
    /// ダメージ効果の変換
    /// </summary>
    /// <param name="dun"></param>
    /// <param name="attacker"></param>
    /// <param name="target"></param>
    /// <param name="damage"></param>
    /// <returns></returns>
    public void DamageDefenceEffect(BaseCharacter attacker, BaseCharacter target, int damage)
    {
        switch (OType)
        {
        //反射
        case OptionType.Reflection:
            int refl = Mathf.CeilToInt((damage * CommonFloat) * Plus);
            attacker.AddDamage(refl);
            EffectDamage d = EffectDamage.CreateObject(attacker);
            d.SetText(refl.ToString(), AttackState.Hit);
            d.Play();

            break;

        //被弾回復
        case OptionType.DefenceRecover:
            int rec = Mathf.CeilToInt((damage * CommonFloat) * Plus);
            target.RecoverHp(rec);
            EffectDamage r = EffectDamage.CreateObject(target);
            r.SetText(rec.ToString(), AttackState.Heal);
            r.Play();
            break;
        }
    }
Example #13
0
    // Use this for initialization
    void Start()
    {
        Active = this;

        EffectDefault         = new Effect();
        AttackManagerDefault  = new AttackManagerPrototype(0.0f, 0.0f, 0, EffectDefault);
        AbilityManagerDefault = new AbilityManagerPrototype(0.0f, 0, AbilityManagerPrototype.TRIGGER.ON_ATTACK, EffectDefault);
        PowerManagerDefault   = new PowerManagerPrototype(0, 0);



        Wall = new TowerPrototype("Wall Tower", 2, null);
        Wall._powerManagerPrototype.SetCanRecieve(false);

        // Rock Launcher
        {
            int[] Damage        = { 31, 96, 224, 448, 960, 1680 };      // Would prefer using a function to generate.
            int   BasePrice     = 10;
            int   BasePower     = 50;
            int   BasePowerRate = 10;
            for (int z = 0; z < 6; z++)
            {
                // Create a Effectdamage, and a projectile to deliver it.
                ProjectilePrototype projectilePrototype = new ProjectilePrototype(9.0f, new EffectDamage(Damage [z], true), SpriteProjectileCannon);

                // Make an EffectProjectile to throw said projectile
                Effect effectCreateProjectile = new EffectProjectile(projectilePrototype, false);
                int    level = z + 1;
                // Make a TowerPrototype
                Cannon [z] = new TowerPrototype("Rock Launcher " + level, (int)LevelScale(level, BasePrice), SpriteTurretCannon);
                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Cannon [z]._attackManagerPrototype = new AttackManagerPrototype(5.0f, 3.0f, Damage [z], effectCreateProjectile);

                // Attack a SpellManager.
                Effect effectOverclockAdd    = new EffectMutableStat(Tower.ATTACK_SPEED, "overclock", 4.0f, true);
                Effect effectOverclockRemove = new EffectMutableStat(Tower.ATTACK_SPEED, "overclock", false);
                Effect effectAddbuff         = new EffectBuff(new BuffPrototype(effectOverclockAdd, effectOverclockRemove, EffectDefault, 5.0f, 0f, true, "Overclock"), EffectBuff.TARGET.SELF, false);

                Cannon[z]._abilityManagerPrototype = new AbilityManagerPrototype(5.0f, (int)LevelScale(level, 25), AbilityManagerPrototype.TRIGGER.CONSTANT, effectAddbuff, "Overclock", "+300% Attack Speed");
                // (float iCooldown, int iEnergyCost, TRIGGER iTrigger, int iDamageDisplay, Effect iEffect)
                // (5.0f, 25, TRIGGER.ON_ATTACK, -1, new EFFECT(Apply Buff self -cooldown, 5 second, something),"Overclock");


                // Attach a PowerManagerPrototype as well, to supply power.
                Cannon [z]._powerManagerPrototype = new PowerManagerPrototype((int)LevelScale(level, BasePower), (int)LevelScale(level, BasePowerRate));
            }

            for (int z = 0; z < 5; z++)
            {
                Cannon [z].SetUpgradesTo(Cannon [z + 1]);
            }
        }


        {
            // Poison Tower
            int[] Damage        = { 20, 53, 107, 196, 341, 567 };
            int[] AbilityDamage = { 33, 156, 489, 1306, 3218, 7560 };
            int   BasePrice     = 20;
            int[] Power         = { 150, 400, 900, 1700, 3300, 6400 };
            int[] PowerCost     = { 40, 115, 250, 500, 980, 1890 };   //{ 40,113,248,500,979,1890 };
            int[] PowerRate     = { 28, 75, 165, 333, 653, 1260 };
            for (int z = 0; z < 6; z++)
            {
                // Create a Effectdamage, and a projectile to deliver it.
                ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(Damage[z], true), SpriteProjectilePoison);

                BuffPrototype       buff = new BuffPrototype(new EffectDamage(AbilityDamage[z], false), EffectDefault, new EffectDamage(AbilityDamage[z] / 10, false), 15.1f, 1.0f, true, "Poison");
                ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(9.0f, new EffectBuff(buff, EffectBuff.TARGET.RUNNER, true), SpriteAbilityProjectilePoison);

                // Make an EffectProjectile to throw said projectile
                Effect effect        = new EffectProjectile(projectilePrototype, false);
                Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false);
                int    level         = z + 1;
                // Make a TowerPrototype
                Poison[z] = new TowerPrototype("Posion Tower " + level, (int)LevelScale(level, BasePrice), SpriteTurretPoison);

                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Poison[z]._attackManagerPrototype = new AttackManagerPrototype(3.5f, 0.4f, Damage [z], effect);


                // Attach a SpellManager.
                Poison[z]._abilityManagerPrototype = new AbilityManagerPrototype(
                    3.0f, PowerCost[z],
                    AbilityManagerPrototype.TRIGGER.ON_ATTACK,
                    effectAbility,
                    "Poison",
                    AbilityDamage[z] + "damage + " + (AbilityDamage[z] / 10) + "dps for 15sec"
                    );



                // Attach a PowerManagerPrototype as well, to supply power.
                Poison [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z]));
            }
            for (int z = 0; z < 5; z++)
            {
                Poison [z].SetUpgradesTo(Poison [z + 1]);
            }
        }


        {
            // Slow Tower
            int[]   Damage        = { 20, 53, 107, 196, 341, 567 };
            int[]   AbilityDamage = { 33, 156, 489, 1306, 3218, 7560 }; // Huh, Poison and Frost have same damage. Well, sort of.
            int     BasePrice     = 15;
            int[]   Power         = { 90, 225, 450, 843, 1551, 2835 };
            int[]   PowerCost     = { 18, 45, 105, 500, 979, 1890 };
            int[]   PowerRate     = { 30, 75, 150, 281, 517, 945 };
            float[] AbilityRange  = { 0.25f, 0.375f, 0.5f, 0.625f, 0.75f, 0.875f }; // A guess, Revamp later.
            float[] Duration      = { 2f, 4f, 7f, 11f, 16f, 21f };
            for (int z = 0; z < 6; z++)
            {
                // Create a Effectdamage, and a projectile to deliver it.
                ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(Damage[z], true), SpriteProjectileFrost);

                Effect effectBuffAdd       = new EffectMutableStat(Runner.MOVEMENT_SPEED, "slow", 0.5f, true);
                Effect effectBuffRemove    = new EffectMutableStat(Runner.MOVEMENT_SPEED, "slow", false);
                Effect effectAddBuff       = new EffectBuff(new BuffPrototype(effectBuffAdd, effectBuffRemove, EffectDefault, Duration[z], 0f, true, "slow"), EffectBuff.TARGET.RUNNER, false);
                Effect effectAOE           = new EffectSplash(effectAddBuff, AbilityRange[z], Effect.TARGET.RUNNER, false);
                Effect effectAbilityDamage = new EffectDamage(AbilityDamage[z], true);
                Effect effectFork          = new EffectFork(effectAOE, effectAbilityDamage, EffectDefault, EffectDefault);
                // Need splash effect and fork effect for this to work correctly.
                // On Impact, call Fork. Damage Target, and AOE on Target ->Apply Debuff
                ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(9.0f, effectFork, SpriteAbilityProjectileFrost);

                // Make an EffectProjectile to throw said projectile
                Effect effect        = new EffectProjectile(projectilePrototype, false);
                Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false);
                int    level         = z + 1;
                // Make a TowerPrototype
                Frost[z] = new TowerPrototype("Frost Tower " + level, (int)LevelScale(level, BasePrice), SpriteTurretFrost);

                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Frost[z]._attackManagerPrototype = new AttackManagerPrototype(3.5f, 1f, Damage[z], effect);


                // Attach a SpellManager.
                Frost[z]._abilityManagerPrototype = new AbilityManagerPrototype(
                    1.0f, PowerCost[z],
                    AbilityManagerPrototype.TRIGGER.ON_ATTACK,
                    effectAbility,
                    "Slow",
                    "50% Slow for " + Duration[z] + "sec"
                    );



                // Attach a PowerManagerPrototype as well, to supply power.
                Frost[z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z]));
            }
            for (int z = 0; z < 5; z++)
            {
                Frost[z].SetUpgradesTo(Frost[z + 1]);
            }
        }

        {
            // Pyro Trap -- NYA
            int   BasePrice     = 25;
            int[] Damage        = { 2, 5, 11, 24, 51, 105 };
            int[] AbilityDamage = { 450, 1443, 3594, 8220, 18135, 39375 };
            float Range         = 1.5f;
            float AbilityRange  = 1.75f;
            int[] Power         = { 200, 600, 2000, 4000, 8000, 20000 };
            int[] PowerCost     = { 113, 356, 875, 1968, 4360, 9450 };
            int[] PowerRate     = { 25, 80, 194, 441, 967, 2100 };
            for (int z = 0; z < 6; z++)
            {
                int level = z + 1;

                // Create a Splash effect that Applies a damage over time buff.
                EffectDamage initialDamage  = new EffectDamage(AbilityDamage[z], false);
                EffectDamage periodicDamage = new EffectDamage(AbilityDamage[z] / 20, false);

                BuffPrototype buff = new BuffPrototype(initialDamage, EffectDefault, periodicDamage, 10.1f, 1.0f, true, "Pyro", "On Fire");

                EffectBuff   dotEffect    = new EffectBuff(buff, Effect.TARGET.RUNNER, false);
                EffectSplash splashEffect = new EffectSplash(dotEffect, AbilityRange, Effect.TARGET.RUNNER, false);

                // Create a direct damage effect.
                EffectDamage attackDamage = new EffectDamage(Damage[z], false);


                // Make a TowerPrototype
                Pyro[z] = new TowerPrototype("Pyro Trap " + level, (int)LevelScale(level, BasePrice), null);

                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Pyro[z]._attackManagerPrototype = new AttackManagerPrototype(Range, 1.0f, Damage [z], attackDamage);


                // Attack a SpellManager.
                Pyro[z]._abilityManagerPrototype = new AbilityManagerPrototype(
                    8.5f, PowerCost[z],
                    AbilityManagerPrototype.TRIGGER.ON_ATTACK,
                    splashEffect,
                    "Firestorm",
                    AbilityDamage[z] + "damage + " + (AbilityDamage[z] / 20) + "dps for 10sec in Range"
                    );



                // Attach a PowerManagerPrototype as well, to supply power.
                Pyro [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z]));
            }

            for (int z = 0; z < 5; z++)
            {
                Pyro [z].SetUpgradesTo(Pyro [z + 1]);
            }
        }

        {
            // Flame Tower
            int   BaseDamage    = 36;//	  { 36, 108, 252,  540, 1116, 2268 };
            int[] AbilityDamage = { 48, 135, 294, 585, 1116, 2079 };
            int   BasePrice     = 20;
            int[] Power         = { 120, 300, 720, 1440, 3000, 6600 };
            int   BasePowerCost = 15;
            int   BasePowerRate = 40;
            for (int z = 0; z < 6; z++)
            {
                int level = z + 1;

                // Create a Effectdamage, and a projectile to deliver it.
                ProjectilePrototype projectilePrototype        = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage), true), SpriteProjectileFlame);
                ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage) + AbilityDamage[z], true), SpriteAbilityProjectileFlame);



                // Make an EffectProjectile to throw said projectile
                Effect effect        = new EffectProjectile(projectilePrototype, false);
                Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false);
                // Make a TowerPrototype
                Flame[z] = new TowerPrototype("Flame Tower " + level, LevelScale(level, BasePrice), SpriteTurretFlame);

                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Flame[z]._attackManagerPrototype = new AttackManagerPrototype(3.0f, 0.75f, LevelScale(level, BaseDamage), effect);


                // Attack a SpellManager.
                Flame[z]._abilityManagerPrototype = new AbilityManagerPrototype(
                    0.75f, (int)LevelScale(level, BasePowerCost),
                    AbilityManagerPrototype.TRIGGER.ON_ATTACK_OVERRIDE,
                    effectAbility,
                    "Ignite",
                    AbilityDamage[z] + " bonus damage."
                    );



                // Attach a PowerManagerPrototype as well, to supply power.
                Flame [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], (int)LevelScale(level, BasePowerRate));
            }

            for (int z = 0; z < 5; z++)
            {
                Flame [z].SetUpgradesTo(Flame [z + 1]);
            }
        }

        {
            // Lightning Tower
            // Temperarlly a rapid-fire attack tower because no lightning effect yet.
            int BaseDamage        = 3;
            int BaseAbilityDamage = 9;            //90;
            int BasePrice         = 10;
            int BasePower         = 160;
            int BasePowerCost     = 2;        //20;
            int BasePowerRate     = 40;
            for (int z = 0; z < 6; z++)
            {
                int level = z + 1;

                // Create a Effectdamage, and a projectile to deliver it.
                ProjectilePrototype projectilePrototype        = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage), true), SpriteProjectileLightning);
                ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(8.0f, new EffectDamage(LevelScale(level, BaseAbilityDamage), true), SpriteAbilityProjectileLightning);



                // Make an EffectProjectile to throw said projectile
                Effect effect        = new EffectProjectile(projectilePrototype, false);
                Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false);
                // Make a TowerPrototype
                Lightning[z] = new TowerPrototype("Lightning Tower " + level, LevelScale(level, BasePrice), SpriteTurretLightning);

                // Attach an AttackManagerPrototype to throw that effect, also display the damage.
                Lightning[z]._attackManagerPrototype = new AttackManagerPrototype(3.0f, 1f, LevelScale(level, BaseDamage), effect);


                // Attack a SpellManager.
                Lightning[z]._abilityManagerPrototype = new AbilityManagerPrototype(
                    0.1f, LevelScale(level, BasePowerCost),
                    AbilityManagerPrototype.TRIGGER.ON_ATTACK_OVERRIDE,
                    effectAbility,
                    "Lightning",
                    LevelScale(level, BaseAbilityDamage) + " damage."
                    );



                // Attach a PowerManagerPrototype as well, to supply power.
                Lightning [z]._powerManagerPrototype = new PowerManagerPrototype(LevelScale(level, BasePower), (int)LevelScale(level, BasePowerRate));
            }

            for (int z = 0; z < 5; z++)
            {
                Lightning [z].SetUpgradesTo(Lightning [z + 1]);
            }
        }

        {
            // Generator
            int BasePrice           = 5;
            int BasePowerGeneration = 5;
            int BasePowerRate       = 10;
            int BasePowerCap        = 250;

            for (int z = 0; z < 6; z++)
            {
                int level = z + 1;

                Generator [z] = new TowerPrototype("Generator " + level, (int)LevelScale(level, BasePrice), SpriteGenerator);

                // Attach a PowerManagerPrototype as well, to supply power.
                Generator [z]._powerManagerPrototype = new PowerManagerPrototype((int)LevelScale(level, BasePowerCap), (int)LevelScale(level, BasePowerRate));

                Generator[z]._powerManagerPrototype.SetPassiveProduction(LevelScale(level, BasePowerGeneration));
                Generator[z]._powerManagerPrototype.SetCanSend(true);
            }

            for (int z = 0; z < 5; z++)
            {
                Generator [z].SetUpgradesTo(Generator [z + 1]);
            }
        }

        {
            // Transfer Tower
            int BasePrice     = 3;
            int BasePowerRate = 30;
            int BasePowerCap  = 300;

            for (int z = 0; z < 6; z++)
            {
                int level = z + 1;

                Transfer [z] = new TowerPrototype("Transfer Tower " + level, (int)LevelScale(level, BasePrice), SpriteTransfer);

                // Attach a PowerManagerPrototype as well, to supply power.
                Transfer [z]._powerManagerPrototype = new PowerManagerPrototype(((int)Mathf.Pow(3, level - 1) * BasePowerCap), ((int)Mathf.Pow(3, level - 1) * BasePowerRate));

                Transfer[z]._powerManagerPrototype.SetCanSend(true);
                Transfer[z]._powerManagerPrototype.SetCanSendLong(true);
            }

            for (int z = 0; z < 5; z++)
            {
                Transfer [z].SetUpgradesTo(Transfer [z + 1]);
            }
        }
    }
Example #14
0
 public EffectDamageReducer(EffectDamage effectDamage)
 {
     this.effectDamage = effectDamage;
 }
Example #15
0
 // Start is called before the first frame update
 void Start()
 {
     Effect = transform.Find("EffectTrigger").GetComponent <EffectDamage>();
     gameObject.SetActive(false);
 }
Example #16
0
    /// <summary>
    /// 投げる効果(誰かに当たった時)
    /// </summary>
    private bool ThrowActionEffect(ManageDungeon dun, PlayerCharacter player, BaseCharacter target)
    {
        switch (BType)
        {
        case BallType.Fire:

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

            int damage = FireBallFixDamage + Mathf.FloorToInt(player.BaseAttack * 2);

            AttackState atState = target.AddDamage(damage);
            //ボールエフェクト
            EffectFireBallLanding.CreateObject(target).Play();

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

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

            //対象が死亡したら
            if (atState == AttackState.Death)
            {
                if (target.Type == ObjectType.Player)
                {
                    ScoreInformation.Info.CauseDeath =
                        string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal);

                    ScoreInformation.Info.CauseDeathType = DeathCouseType.Item;
                }

                DisplayInformation.Info.AddMessage(
                    target.GetMessageDeath(target.HaveExperience));

                player.Death(target, player.AttackInfo);
                target.DeathAction(dun);
            }
            break;

        case BallType.Gyro:

            SoundInformation.Sound.Play(SoundInformation.SoundType.BucketFall);

            //ターゲットが吹き飛ぶ先のポイントを取得
            bool     isWall;
            MapPoint point = dun.GetBlow(target.CurrentPoint, Direction, out isWall);

            //対象のポイントが取得できなければ
            if (CommonFunction.IsNull(point) == true)
            {
            }
            //対象ポイントが取得できればそこに移動
            else
            {
                if (typeof(BaseEnemyCharacter) == target.GetType())
                {
                    ((BaseEnemyCharacter)target).MoveState = EnemySearchState.FightPlayer;
                }
                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.BlowCharacter, target.DisplayNameInMessage));
                target.BlowDirection = Direction;
                target.BlowPoint     = point;
                target.MoveSpeed     = CommonConst.SystemValue.MoveSpeedDash;
                dun.MoveCharacter(point, target);

                //対象に衝突ダメージ
                if (isWall == true)
                {
                    target.BlowAfterDamage = GyroFixDamage;
                }

                //吹っ飛び先に誰かがいた場合
                MapPoint      vector = CommonFunction.CharacterDirectionVector[Direction];
                MapPoint      next   = MapPoint.Get(point.X + vector.X, point.Y + vector.Y);
                BaseCharacter second = dun.CharacterMap.Get(point.X, point.Y);
                if (CommonFunction.IsNull(second) == false)
                {
                    second.BlowAfterDamage = GyroFixDamage;
                    second.BlowPoint       = second.CurrentPoint;
                }
            }

            break;

        case BallType.Change:

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

            if (typeof(BaseEnemyCharacter) == target.GetType())
            {
                ((BaseEnemyCharacter)target).MoveState = EnemySearchState.FightPlayer;
            }
            //ターゲットとプレイヤーの場所を交換

            EffectSmoke.CreateObject(target).Play();
            EffectSmoke.CreateObject(player).Play();
            MapPoint tarp = target.CurrentPoint;
            target.SetPosition(player.CurrentPoint.X, player.CurrentPoint.Y);
            player.SetPosition(tarp.X, tarp.Y);
            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.ChangePoint, target.DisplayNameInMessage));
            break;

        case BallType.Pickoff:

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

            //対象に混乱を付与
            int result = target.AddStateAbnormal((int)StateAbnormal.Confusion);
            //対象が混乱になったらメッセージを表示
            if (result != 0)
            {
                EffectSmoke.CreateObject(target).Play();
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Confusion, target));
            }
            break;

        case BallType.Bean:

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

            //対象に麻痺を付与
            int bresult = target.AddStateAbnormal((int)StateAbnormal.Palalysis);
            //対象が麻痺になったらメッセージを表示
            if (bresult != 0)
            {
                EffectSmoke.CreateObject(target).Play();
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Palalysis, target));
            }
            break;

        case BallType.Decoy:

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

            //対象にデコイを付与
            int dresult = target.AddStateAbnormal((int)StateAbnormal.Decoy);
            //対象がデコイになったらメッセージを表示
            if (dresult != 0)
            {
                EffectSmoke.CreateObject(target).Play();
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Decoy, target));
            }
            break;

        case BallType.Slow:

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

            //対象にスローを付与
            int sresult = target.AddStateAbnormal((int)StateAbnormal.Slow);
            //対象がスローになったらメッセージを表示
            if (sresult != 0)
            {
                EffectSmoke.CreateObject(target).Play();
                DisplayInformation.Info.AddMessage(
                    CommonFunction.GetAbnormalMessage(StateAbnormal.Slow, target));
            }
            break;

        //ナックル
        case BallType.Knuckle:

            List <BallType> blist = new List <BallType>();
            foreach (BallType val in Enum.GetValues(typeof(BallType)))
            {
                blist.Add(val);
            }
            blist.Remove(BallType.Knuckle);
            blist.Remove(BallType.Handmaid);

            //ナックル以外の効果をランダムで取得
            BallType temp = blist[UnityEngine.Random.Range(0, blist.Count)];

            BallBase b = new BallBase();
            b.CurrentPoint = CurrentPoint;
            b.Direction    = Direction;
            b.BType        = temp;
            //効果を発動
            b.ThrowActionEffect(dun, player, target);
            break;

        case BallType.Trap:

            TrapBreaker(dun, player);
            break;

        case BallType.Handmaid:

            //ヒットエフェクト
            EffectFireBallLanding.CreateObject(target).Play();

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

            //範囲拡大がついているとき
            int   plus;
            float cf;
            int   dist = 0;
            if (CommonFunction.HasOptionType(this.Options, OptionType.Wildfire, out plus, out cf) == true)
            {
                dist = plus;
            }

            dun.SetUpCharacterMap();
            List <BaseCharacter> targets = dun.GetNearCharacters(target.CurrentPoint, dist, true);

            foreach (BaseCharacter t in targets)
            {
                //int damage2 = FireBallFixDamage + Mathf.FloorToInt(player.BaseAttack * 2);
                int damage2 = Mathf.FloorToInt((15 + player.BaseAttack) / (target.CurrentPoint.DistanceAbs(t.CurrentPoint) + 1));

                //効果増幅があったら
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectUp, out plus, out cf) == true)
                {
                    damage2 = damage2 + plus * (int)cf;
                }
                //効果縮小があったら
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectDown, out plus, out cf) == true)
                {
                    damage2 = damage2 - plus * (int)cf;
                }

                //ダメージ増減30%
                float rand = 0.3f;
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectStabile, out plus, out cf) == true)
                {
                    rand -= cf * plus;
                }
                else if (CommonFunction.HasOptionType(this.Options, OptionType.EffectNotStabile, out plus, out cf) == true)
                {
                    rand += cf * plus;
                }

                damage2 += Mathf.CeilToInt(UnityEngine.Random.Range(-rand * damage2, rand * damage2));

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

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

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

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

                        if (t.Type == ObjectType.Player)
                        {
                            ScoreInformation.Info.CauseDeath =
                                string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal);

                            ScoreInformation.Info.CauseDeathType = DeathCouseType.Item;

                            t.Death();
                        }
                        else
                        {
                            if (IsExp == true)
                            {
                                player.Death(t, player.AttackInfo);
                            }
                            else
                            {
                                t.Death();
                            }
                        }
                        t.DeathAction(dun);
                    }
                }
                //基本効果反転
                else
                {
                    t.RecoverHp(damage2);

                    //ヒットエフェクト
                    EffetHitShockWave.CreateObject(t).Play();

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

                    //ヒットメッセージ
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverHp, t.DisplayNameInMessage));
                }
            }

            //状態異常の付与
            EffectAbnormal(targets);

            //火柱があれば火柱を立てる
            if (CommonFunction.HasOptionType(this.Options, OptionType.CatchingFire) == true)
            {
                dun.SetUpTrapMap();
                if (CommonFunction.IsNull(dun.TrapMap.Get(CurrentPoint)) == true)
                {
                    BaseTrap trap = TableTrap.GetTrap(CommonConst.ObjNo.Ember);
                    trap.Options   = CommonFunction.CloneOptions(this.Options);
                    trap.IsVisible = true;
                    trap.SetThisDisplayTrap(CurrentPoint.X, CurrentPoint.Y);
                    dun.AddNewTrap(trap);

                    DisplayInformation.Info.AddMessage(
                        CommonConst.Message.TrapEmber);
                }
            }

            break;

        case BallType.Fumble:
            //対象のレベルが2以上ならレベルを下げる
            if (target.Level > 1)
            {
                if (target.Type == ObjectType.Enemy)
                {
                    BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target);
                    enemy.Level--;
                    TableEnemy.SetLevel(enemy, enemy.Level,
                                        DisplayInformation.Info.Floor,
                                        DungeonInformation.Info.EnemyHpProb,
                                        DungeonInformation.Info.EnemyAtkProb,
                                        DungeonInformation.Info.EnemyExpProb,
                                        DungeonInformation.Info.StartProbHp,
                                        DungeonInformation.Info.StartProbAtk,
                                        DungeonInformation.Info.StartProbExp);

                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.LevelDownPlayer, enemy.DisplayNameInMessage));

                    EffectBadSmoke.CreateObject(enemy).Play();
                }
            }

            break;

        case BallType.Winning:

            if (target.Type == ObjectType.Enemy)
            {
                BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target);
                enemy.Level++;
                TableEnemy.SetLevel(enemy, enemy.Level,
                                    DisplayInformation.Info.Floor,
                                    DungeonInformation.Info.EnemyHpProb,
                                    DungeonInformation.Info.EnemyAtkProb,
                                    DungeonInformation.Info.EnemyExpProb,
                                    DungeonInformation.Info.StartProbHp,
                                    DungeonInformation.Info.StartProbAtk,
                                    DungeonInformation.Info.StartProbExp);

                DisplayInformation.Info.AddMessage(
                    string.Format(CommonConst.Message.LevelUpPlayer, enemy.DisplayNameInMessage));

                EffectFlareCore.CreateObject(enemy).Play();
            }
            break;

        case BallType.Four:

            if (target.Type == ObjectType.Enemy)
            {
                BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target);

                if (enemy.IsFourBallCount() == true)
                {
                    int dam = Mathf.CeilToInt(enemy.MaxHp);

                    AttackState atstate = target.AddDamage(dam);
                    //ボールエフェクト
                    EffetHitShockWave.CreateObject(enemy).Play();

                    //ダメージエフェクト
                    EffectDamage dt = EffectDamage.CreateObject(target);
                    dt.SetText(dam.ToString(), AttackState.Hit);
                    dt.Play();

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

                    SoundInformation.Sound.Play(SoundInformation.SoundType.AttackHit);

                    //対象が死亡したら
                    if (atstate == AttackState.Death)
                    {
                        if (target.Type == ObjectType.Player)
                        {
                            ScoreInformation.Info.CauseDeath =
                                string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal);

                            ScoreInformation.Info.CauseDeathType = DeathCouseType.Item;
                        }
                        DisplayInformation.Info.AddMessage(
                            target.GetMessageDeath(target.HaveExperience));

                        player.Death(target, player.AttackInfo);
                        target.DeathAction(dun);
                    }
                }
                else
                {
                    SoundInformation.Sound.Play(SoundInformation.SoundType.AttackHit);
                    //ボールエフェクト
                    EffetHitShockWave.CreateObject(enemy).Play();
                }
            }

            break;

        case BallType.Emery:

            if (target.Type == ObjectType.Enemy)
            {
                BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target);

                if (enemy.IsBoss() == false)
                {
                    GameStateInformation.Info.EmeryTarget = target.ObjNo;

                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.EmeryCharacter, target.DisplayNameInMessage));

                    List <BaseCharacter> emeryies = dun.Characters.FindAll(i => i.ObjNo == target.ObjNo);

                    SoundInformation.Sound.Play(SoundInformation.SoundType.Summon);

                    foreach (BaseCharacter c in emeryies)
                    {
                        EffectSmoke.CreateObject(c, false).Play();

                        dun.RemoveCharacter(c);
                        ManageDungeon.KillObjectNow(c);
                    }
                }
            }
            break;
        }
        Options = null;

        return(true);
    }
    public virtual AttackState Attack(ManageDungeon dun, BaseCharacter target, BaseCharacter attacker, int power, AttackInformation atinf)
    {
        int damage = 0;

        atinf.AddTarget(target);

        //声を鳴らす
        atinf.AddVoice(attacker.VoiceAttack());

        //攻撃の命中判定
        if (CommonFunction.IsRandom(WeaponDexterity) == true)
        {
            //行動タイプを設定
            atinf.SetBehType(BehaviorType.Attack);

            //命中したら
            atinf.AddHit(target, true);

            //声を鳴らす
            atinf.AddVoice(target.VoiceDefence());

            //サウンドを鳴らす
            atinf.AddSound(GetAttackHitSound());

            BaseOption[] atoptions = attacker.Options;
            BaseOption[] tgoptions = target.Options;

            //与ダメージを計算
            damage = CalcDamage(dun, attacker, target, power, atoptions, tgoptions, 1);

            //スコア関連値の更新
            if (target.Type == ObjectType.Enemy)
            {
                TotalDamage += damage;
                if (ScoreInformation.Info.MostUseWeaponDamage < TotalDamage)
                {
                    ScoreInformation.Info.MostUseWeaponDamage = TotalDamage;
                    ScoreInformation.Info.MostUseWeaponName   = DisplayNameNormal;
                }

                ScoreInformation.Info.AddScore(damage);
            }

            //atinf.AddDamage(target.Name, damage);

            ////ヒットメッセージ
            //atinf.AddMessage(
            //    target.GetMessageAttackHit(this.DisplayNameInMessage, damage));

            ////ダメージ判定
            //AttackState atState = target.AddDamage(damage);
            //ダメージ追加
            AttackState atState = CommonFunction.AddDamage(atinf, attacker, target, damage);

            //ガラスアイテム判定
            WeaponBase atw = attacker.EquipWeapon;
            foreach (BaseOption op in atw.Options)
            {
                if (op.IsBreak() == true)
                {
                    atinf.AddSound(SoundInformation.SoundType.Break);

                    atinf.AddMessage(
                        string.Format(CommonConst.Message.BreakItem, atw.DisplayNameInMessage));

                    atw.ForceRemoveEquip(attacker);
                    PlayerCharacter.RemoveItem(atw);
                }
            }
            ShieldBase tgs = target.EquipShield;
            foreach (BaseOption op in tgs.Options)
            {
                if (op.IsBreak() == true)
                {
                    atinf.AddSound(SoundInformation.SoundType.Break);

                    atinf.AddMessage(
                        string.Format(CommonConst.Message.BreakItem, tgs.DisplayNameInMessage));

                    tgs.ForceRemoveEquip(target);
                    PlayerCharacter.RemoveItem(tgs);
                }
            }


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

                atinf.AddMessage(
                    target.GetMessageDeath(target.HaveExperience));
            }
            else
            {
                //atinf.IsDeath.Add(target.Name, false);

                addabnormal.Clear();
                prevents.Clear();
                foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                {
                    prevents.Add(val, 0);
                    addabnormal.Add(val, AddAbnormalProb[val]);
                }

                int opab = 0;
                //オプションの付加値設定
                foreach (BaseOption o in atoptions)
                {
                    int ab = o.SetAbnormalAttack(addabnormal);
                    opab = opab | ab;
                }

                int tarabn = AddAbnormal | opab;

                if (tarabn != 0)
                {
                    //オプションによる状態異常の取得
                    //foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                    //{
                    //    addabnormal.Add(val, 0);
                    //}

                    //オプションの抵抗値設定
                    foreach (BaseOption o in tgoptions)
                    {
                        o.SetAbnormalPrevent(prevents);
                    }

                    int abn = 0;
                    //状態異常の付与
                    foreach (StateAbnormal val in CommonFunction.StateAbnormals)
                    {
                        int abnormal = (int)val & tarabn;

                        //対象の状態異常を処理
                        if (abnormal != 0)
                        {
                            //float prob = prevents[val] > AddAbnormalProb[val] ? prevents[val] : AddAbnormalProb[val];
                            //状態異常付与が成功したとき
                            if (CommonFunction.IsRandom(addabnormal[val]) == true)
                            {
                                //抵抗に成功したとき
                                if (CommonFunction.IsRandom(prevents[val]) == true)
                                {
                                }
                                else
                                {
                                    int addstate = target.AddStateAbnormal(abnormal);
                                    if (addstate != 0)
                                    {
                                        abn += abnormal;
                                        //atinf.AddAbnormal(target, abnormal);

                                        atinf.AddMessage(
                                            CommonFunction.GetAbnormalMessage(val, target));
                                    }
                                }
                            }
                        }
                    }
                    if (abn != 0)
                    {
                        atinf.AddEffect(EffectBadSmoke.CreateObject(target));
                        atinf.AddAbnormal(target, abn);
                    }
                }
            }

            //エフェクトをかける
            this.AttackEffect(target, attacker, damage.ToString(), AttackState.Hit, atinf);

            return(atState);
        }
        else
        {
            //外れた場合
            atinf.AddHit(target, false);

            EffectDamage d = EffectDamage.CreateObject(target);
            d.SetText("Miss", AttackState.Miss);
            atinf.AddEffect(d);

            atinf.AddSound(GetAttackMissSound());

            atinf.AddMessage(
                target.GetMessageAttackMiss());
            return(AttackState.Miss);
        }
    }
Example #18
0
    /// <summary>
    /// 使う全般
    /// </summary>
    public bool CommonUseItemCustom(ManageDungeon dun, BaseCharacter center, BaseCharacter player)
    {
        //サウンドを鳴らす
        SoundInformation.Sound.Play(SoundInformation.SoundType.Recover);

        //範囲拡大がついているとき
        int   plus;
        float cf;
        int   dist = 0;

        if (CommonFunction.HasOptionType(this.Options, OptionType.Wildfire, out plus, out cf) == true)
        {
            dist = plus;
        }
        dun.SetUpCharacterMap();
        List <BaseCharacter> targets = dun.GetNearCharacters(center.CurrentPoint, dist, true);

        foreach (BaseCharacter target in targets)
        {
            //満腹度の回復
            if (SatRecoverPoint > 0)
            {
                if (typeof(PlayerCharacter) == target.GetType())
                {
                    float satRecoverPoint = SatRecoverPoint;

                    //効果増幅があったら
                    if (CommonFunction.HasOptionType(this.Options, OptionType.EffectUp, out plus, out cf) == true)
                    {
                        satRecoverPoint = satRecoverPoint + plus * cf;
                    }
                    if (CommonFunction.HasOptionType(this.Options, OptionType.EffectDown, out plus, out cf) == true)
                    {
                        satRecoverPoint = satRecoverPoint - plus * cf;
                    }
                    //ダメージ増減30%
                    float rand = 0.3f;
                    if (CommonFunction.HasOptionType(this.Options, OptionType.EffectStabile, out plus, out cf) == true)
                    {
                        rand -= cf * plus;
                    }
                    else if (CommonFunction.HasOptionType(this.Options, OptionType.EffectNotStabile, out plus, out cf) == true)
                    {
                        rand += cf * plus;
                    }
                    satRecoverPoint += Mathf.CeilToInt(UnityEngine.Random.Range(-rand * satRecoverPoint, rand * satRecoverPoint));


                    //減少判定の時
                    if (CommonFunction.HasOptionType(this.Options, OptionType.ReverceDamage) == true)
                    {
                        ((PlayerCharacter)target).ReduceSatiety(satRecoverPoint);
                        DisplayInformation.Info.AddMessage(
                            string.Format(CommonConst.Message.TrapCroquette2, target.DisplayNameInMessage));
                    }
                    //通常回復判定のとき
                    else
                    {
                        ((PlayerCharacter)target).AddSatiety(satRecoverPoint);
                        if (((PlayerCharacter)target).IsSatietyMax == true)
                        {
                            DisplayInformation.Info.AddMessage(
                                string.Format(CommonConst.Message.RecoverSatietyMax));
                        }
                        else
                        {
                            DisplayInformation.Info.AddMessage(
                                string.Format(CommonConst.Message.RecoverSatiety));
                        }
                    }
                }
            }
            //HPの回復
            if (HpRecoverPoint > 0)
            {
                //ダメージ追加
                int damage = Mathf.FloorToInt(HpRecoverPoint / (center.CurrentPoint.DistanceAbs(target.CurrentPoint) + 1));

                //効果増幅があったら
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectUp, out plus, out cf) == true)
                {
                    damage = damage + plus * (int)cf;
                }
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectDown, out plus, out cf) == true)
                {
                    damage = damage - plus * (int)cf;
                }
                //ダメージ増減30%
                float rand = 0.3f;
                if (CommonFunction.HasOptionType(this.Options, OptionType.EffectStabile, out plus, out cf) == true)
                {
                    rand -= cf * plus;
                }
                else if (CommonFunction.HasOptionType(this.Options, OptionType.EffectNotStabile, out plus, out cf) == true)
                {
                    rand += cf * plus;
                }
                damage += Mathf.CeilToInt(UnityEngine.Random.Range(-rand * damage, rand * damage));


                //減少判定の時
                if (CommonFunction.HasOptionType(this.Options, OptionType.ReverceDamage) == true)
                {
                    AttackState atState = target.AddDamage(damage);

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

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

                    //対象が死亡したら
                    if (atState == AttackState.Death)
                    {
                        DisplayInformation.Info.AddMessage(
                            target.GetMessageDeath(target.HaveExperience));
                        if (target.Type == ObjectType.Player)
                        {
                            ScoreInformation.Info.CauseDeath =
                                string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal);

                            ScoreInformation.Info.CauseDeathType = DeathCouseType.Item;

                            target.Death();
                        }
                        else
                        {
                            player.Death(target, player.AttackInfo);
                        }
                        target.DeathAction(dun);
                    }
                }
                //通常回復判定のとき
                else
                {
                    target.RecoverHp(HpRecoverPoint);

                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverHp, target.DisplayNameInMessage));

                    //回復エフェクト
                    EffectDamage d = EffectDamage.CreateObject(target);
                    d.SetText(HpRecoverPoint.ToString(), AttackState.Heal);
                    d.Play();
                }
            }

            //Power回復
            if (CommonFunction.HasOptionType(this.Options, OptionType.RecoverPower) == true)
            {
                if (target.RecoverPowerNotMaxup(1) == true)
                {
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverPower, target.DisplayNameInMessage));
                }
            }
        }
        //状態異常の付与
        EffectAbnormal(targets);

        return(true);
    }
Example #19
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);
    }
Example #20
0
    /// <summary>
    /// 使う全般
    /// </summary>
    public bool CommonUseItem(BaseCharacter player)
    {
        //サウンドを鳴らす
        SoundInformation.Sound.Play(SoundInformation.SoundType.Recover);

        //満腹度の回復
        if (SatRecoverPoint > 0)
        {
            if (typeof(PlayerCharacter) == player.GetType())
            {
                ((PlayerCharacter)player).AddSatiety(SatRecoverPoint);
                if (((PlayerCharacter)player).IsSatietyMax == true)
                {
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverSatietyMax));
                }
                else
                {
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverSatiety));
                }
            }
        }
        //HPの回復
        if (HpRecoverPoint > 0)
        {
            player.RecoverHp(HpRecoverPoint);

            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.RecoverHp, player.DisplayNameInMessage));

            //回復エフェクト
            EffectDamage d = EffectDamage.CreateObject(player);
            d.SetText(HpRecoverPoint.ToString(), AttackState.Heal);
            d.Play();
        }
        //状態の回復
        if (StatusRecoverTarget != 0)
        {
            foreach (StateAbnormal val in CommonFunction.StateAbnormals)
            {
                //対象の状態異常を含んでいなければ無視
                if ((StatusRecoverTarget & (int)val) == 0)
                {
                    continue;
                }

                //状態異常の回復に成功したら
                int ret = player.RecoverState((int)val);
                if (ret != 0)
                {
                    player.RemoveAbnormalObject(val);
                    DisplayInformation.Info.AddMessage(
                        string.Format(CommonConst.Message.RecoverState, CommonFunction.StateNames[val]));
                }
            }
        }

        //状態異常の付与
        if (StatusBadTarget != 0)
        {
            int state = player.AddStateAbnormal(StatusBadTarget);

            bool isBad = false;

            foreach (StateAbnormal val in CommonFunction.StateAbnormals)
            {
                if ((state & (int)val) != 0)
                {
                    DisplayInformation.Info.AddMessage(
                        CommonFunction.GetAbnormalMessage(val, player));

                    if (CommonFunction.BadAbnormals.Contains(val))
                    {
                        isBad = true;
                    }
                }
            }
            if (state != 0)
            {
                if (isBad == true)
                {
                    EffectBadSmoke.CreateObject(player).Play();
                    //サウンドを鳴らす
                    SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke);
                }
                else
                {
                    EffectSmoke.CreateObject(player).Play();
                }
            }
        }
        return(true);
    }
Example #21
0
 internal void ReceiveAttack(EffectDamage a_dmg)
 {
     /*if(onDamageReceived != null)
      *      onDamageReceived(a_dmg);*/
 }
Example #22
0
    /// <summary>
    /// 食べる
    /// </summary>
    public override bool Use(ManageDungeon dun, BaseCharacter player)
    {
        switch (CType)
        {
        case CandyType.Energy:

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

            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.RecoverPower));

            player.RecoverPower(99);

            break;

        case CandyType.Handmaid:

            this.CommonUseItemCustom(dun, player, player);

            break;

        case CandyType.Bomb:

            List <BaseCharacter> list = dun.GetNearCharacters(player.CurrentPoint, 2, true);

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

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

            //ダメージ処理
            int damage = Mathf.CeilToInt(player.MaxHp / 2);
            if (damage > 50)
            {
                damage = 50;
            }
            foreach (BaseCharacter c in list)
            {
                AttackState  atState = c.AddDamage(damage);
                EffectDamage d2      = EffectDamage.CreateObject(c);
                d2.SetText(damage.ToString(), AttackState.Hit);
                d2.Play();

                //対象が死亡したら
                if (atState == AttackState.Death)
                {
                    //プレイヤーが死亡したら
                    if (c.Type == ObjectType.Player)
                    {
                        DisplayInformation.Info.AddMessage(
                            player.GetMessageDeath(player.HaveExperience));

                        ScoreInformation.Info.CauseDeath =
                            string.Format(CommonConst.DeathMessage.Trap, DisplayNameNormal);
                        ScoreInformation.Info.CauseDeathType = DeathCouseType.Trap;
                    }
                    else
                    {
                        DisplayInformation.Info.AddMessage(
                            string.Format(CommonConst.Message.DeathCommon, c.DisplayNameInMessage));
                    }

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

            break;

        case CandyType.Garlic:

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

            DisplayInformation.Info.AddMessage(
                string.Format(CommonConst.Message.IncreaseHp));

            player.MaxHpCorrection += 5;

            break;


        default:
            this.CommonUseItem(player);
            break;
        }
        return(true);
    }
Example #23
0
    public override void Create(EffectBase effect, SkillView sv)
    {
        base.Create(effect, sv);

        m_effect_damage = effect as EffectDamage;
    }
Example #24
0
    /// <summary>
    /// アイテムを入れる
    /// </summary>
    public BaseItem PutinItem(int itype, BaseItem target, PlayerCharacter player)
    {
        //サウンドを鳴らす
        SoundInformation.Sound.Play(SoundInformation.SoundType.Putin);

        DisplayInformation.Info.AddMessage(string.Format(CommonConst.Message.PutinAction, target.DisplayNameInMessage, this.DisplayNameInMessage));

        switch (BgType)
        {
        //保存
        case BagType.Save:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;

        //Recycle
        case BagType.Recycle:

            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }

            OtherBase d = TableOther.GetItem(CommonConst.ObjNo.Dollar);
            d.Initialize();
            d.SellingPrice = target.SellingPrice;

            player.RecoverHp(999);
            EffectDamage dm = EffectDamage.CreateObject(player);
            dm.SetText("999", AttackState.Heal);
            dm.Play();
            SoundInformation.Sound.Play(SoundInformation.SoundType.Recover);

            BagItems.Add(d);
            d.InDrive = this;

            return(d);

            break;

        //変化
        case BagType.Change:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            //uintの乱数を取得
            uint     rand = CommonFunction.GetRandomUInt32();
            BaseItem ch   = TableItemIncidence.GetItem(itype, rand, true);
            if (CommonFunction.IsNull(ch) == true)
            {
                return(null);
            }
            int stopper = 0;
            while (ch.IType == ItemType.Bag || ch.IType == ItemType.Material)
            {
                if (stopper > 30)
                {
                    return(null);
                }
                stopper++;
                rand = CommonFunction.GetRandomUInt32();
                ch   = TableItemIncidence.GetItem(itype, rand, true);
            }

            ch.IsAnalyse = DungeonInformation.Info.IsAnalyze == false;
            BagItems.Add(ch);
            ch.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(ch, DateTime.Now.Ticks);

            return(ch);

            break;

        //コロッケ
        case BagType.Food:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            BaseItem tar = TableItemIncidence.GetTypeItemRandom(itype, ItemType.Food, true);
            if (CommonFunction.IsNull(tar) == true)
            {
                return(null);
            }
            BagItems.Add(tar);
            tar.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(tar, DateTime.Now.Ticks);

            return(tar);

            break;

        //普通
        case BagType.Normal:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;
        }

        return(target);
    }
Example #25
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);
    }