예제 #1
0
        public override List <EffectData> Apply(FieldManager manager, UpgradeManager upgradeManager, Random random, GameMatch match, int playerUserIndex, Combo combo)
        {
            Player       player             = playerUserIndex == 1 ? match.Player1 : match.Player2;
            Field        playerField        = playerUserIndex == 1 ? match.Field1 : match.Field2;
            UpgradesInfo playerUpgradesInfo = playerUserIndex == 1 ? match.Player1Upgrades : match.Player2Upgrades;

            int effectsCount = Math.Max(1, combo.Blocks.Count - FieldManager.MinComboCount);

            List <EffectData> data   = new List <EffectData>();
            float             health = HealthToRestore * combo.EffectScale
                                       * upgradeManager.GetHealthBlockUpgradeBonus(playerUpgradesInfo);

            data.Add(EffectDataHelper.HealthData(player, health * effectsCount));

            for (int i = 0; i < effectsCount; i++)
            {
                player.GainHealth(health);
            }

            if (combo.Blocks.Count > 3)
            {
                data.AddRange(BlockEffectsHelper.CreateUniqueBlock(manager, random, playerField, player, combo, ComboEffectType));
            }

            return(data);
        }
예제 #2
0
        public override List <EffectData> Apply(FieldManager manager, UpgradeManager upgradeManager, Random random, GameMatch match, int playerUserIndex, Combo combo)
        {
            Player player      = playerUserIndex == 1 ? match.Player1 : match.Player2;
            Field  playerField = playerUserIndex == 1 ? match.Field1 : match.Field2;

            List <EffectData> data = new List <EffectData>();

            if (combo.Blocks.Count > 3)
            {
                data.AddRange(BlockEffectsHelper.CreateRandomUniqueBlock(manager, random, playerField, player, combo, 6));
            }

            return(data);
        }
예제 #3
0
        public override List <EffectData> Apply(FieldManager manager, UpgradeManager upgradeManager, Random random, GameMatch match, int playerUserIndex, Combo combo)
        {
            Player       player             = playerUserIndex == 1 ? match.Player1 : match.Player2;
            Field        playerField        = playerUserIndex == 1 ? match.Field1 : match.Field2;
            Player       enemy              = playerUserIndex == 1 ? match.Player2 : match.Player1;
            Field        enemyField         = playerUserIndex == 1 ? match.Field2 : match.Field1;
            UpgradesInfo playerUpgradesInfo = playerUserIndex == 1 ? match.Player1Upgrades : match.Player2Upgrades;

            int effectsCount = Math.Max(1, combo.Blocks.Count - FieldManager.MinComboCount);

            List <EffectData> data = new List <EffectData>();

            if (enemyField.TryBlock(out var effect))
            {
                data.Add(EffectDataHelper.GlobalEffectRemovedData(enemy, effect.Type));
            }
            else
            {
                float damage = DamageToEnemyHealth * combo.EffectScale
                               * upgradeManager.GetAttackBlockUpgradeBonus(playerUpgradesInfo);
                data.Add(EffectDataHelper.HealthData(enemy, -damage * effectsCount));
                for (int i = 0; i < effectsCount; i++)
                {
                    enemy.TakeDamage(damage);

                    for (int j = 0; j < BlocksToAttackCount; j++)
                    {
                        Block block = manager.GetRandomNonDestroyedBlocks(enemyField).FirstOrDefault();
                        if (block != null)
                        {
                            manager.DestroyBlocks(enemyField, new List <Block> {
                                block
                            }, BlockState.DestroyedByDamage);
                            data.Add(EffectDataHelper.ShotData(playerField, enemyField, combo.Blocks.First(), block, -DamageToBlockHealth));
                        }
                    }
                }
            }

            if (combo.Blocks.Count > 3)
            {
                data.AddRange(BlockEffectsHelper.CreateUniqueBlock(manager, random, playerField, player, combo, ComboEffectType));
            }

            return(data);
        }