Esempio n. 1
0
        public bool TestCharacterTriggerEffect(CharacterTriggerRelicEffectParams relicEffectParams)
        {
            CharacterState characterState = relicEffectParams.characterState;

            if (characterState.IsDestroyed)
            {
                return(false);
            }
            if (relicEffectParams.trigger != CharacterTriggerData.Trigger.OnAttacking)
            {
                return(false);
            }
            if (relicEffectParams.combatManager.GetCombatPhase() == CombatManager.Phase.HeroTurn || relicEffectParams.combatManager.GetCombatPhase() == CombatManager.Phase.PreCombat || relicEffectParams.combatManager.GetCombatPhase() == CombatManager.Phase.BossActionPreCombat)
            {
                return(false);
            }
            if (characterState.GetStatusEffectStacks("ambush") <= 0)
            {
                return(false);
            }

            TargetMode targetMode = TargetMode.LastAttackedCharacter;

            if (characterState.GetStatusEffectStacks("sweep") > 0)
            {
                targetMode = TargetMode.Room;
            }

            try
            {
                TargetHelper.CollectTargetsData collectTargetsData = default(TargetHelper.CollectTargetsData);
                collectTargetsData.targetMode = targetMode;
                collectTargetsData.targetModeStatusEffectsFilter = new List <string>();
                collectTargetsData.targetModeHealthFilter        = CardEffectData.HealthFilter.Both;
                collectTargetsData.targetTeamType = Team.Type.Heroes;
                collectTargetsData.roomIndex      = characterState.GetSpawnPoint().GetRoomOwner().GetRoomIndex();
                collectTargetsData.heroManager    = relicEffectParams.heroManager;
                collectTargetsData.monsterManager = relicEffectParams.monsterManager;
                collectTargetsData.roomManager    = relicEffectParams.roomManager;
                collectTargetsData.inCombat       = false;
                collectTargetsData.isTesting      = true;
                collectTargetsData.selfTarget     = characterState;

                _targets.Clear();
                TargetHelper.CollectTargets(collectTargetsData, ref _targets);

                return(_targets.Count > 0);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
        public void ShareStatusEffects(string statusId, int count)
        {
            ProviderManager.TryGetProvider <RoomManager>(out RoomManager roomManager);
            ProviderManager.TryGetProvider <CardManager>(out CardManager CardManager);

            List <CharacterState> targets = new List <CharacterState>();

            ProviderManager.TryGetProvider <StatusEffectManager>(out StatusEffectManager statusEffectManager);
            var statusData = statusEffectManager.GetStatusEffectDataById(statusId);

            //if (statusData.GetDisplayCategory() == StatusEffectData.DisplayCategory.Positive)
            //    roomManager.GetRoom(owner.GetCurrentRoomIndex()).AddCharactersToList(targets, Team.Type.Monsters);

            //if (statusData.GetDisplayCategory() == StatusEffectData.DisplayCategory.Negative && reflectDebuffs)
            //    roomManager.GetRoom(owner.GetCurrentRoomIndex()).AddCharactersToList(targets, Team.Type.Heroes);

            var collector = new TargetHelper.CollectTargetsData
            {
                cardManager    = CardManager,
                heroManager    = ProviderManager.CombatManager.GetHeroManager(),
                ignoreDead     = true,
                monsterManager = ProviderManager.CombatManager.GetMonsterManager(),
                roomIndex      = owner.GetCurrentRoomIndex(),
                combatManager  = ProviderManager.CombatManager,
                roomManager    = roomManager,
                skipCharacters = new List <CharacterState> {
                    owner
                },
                targetModeStatusEffectsFilter = new List <string>(),
            };

            int statCount = (int)Math.Ceiling(count * multiplyIncrease);

            if (statusData.GetDisplayCategory() == StatusEffectData.DisplayCategory.Positive || statusId == Armor || statusId == Burnout)
            {
                //roomManager.GetRoom(owner.GetCurrentRoomIndex()).AddCharactersToList(targets, Team.Type.Monsters);
                collector.targetTeamType = Team.Type.Monsters;
            }

            if (statusData.GetDisplayCategory() == StatusEffectData.DisplayCategory.Negative && reflectDebuffs)
            {
                //roomManager.GetRoom(owner.GetCurrentRoomIndex()).AddCharactersToList(targets, Team.Type.Heroes);
                collector.targetTeamType = Team.Type.Heroes;
                owner.RemoveStatusEffect(statusId, false, 999);
                statCount = (int)Math.Ceiling(count * (multiplyIncrease + 1f));
            }

            // Random
            if (targeting == 0)
            {
                collector.targetMode = TargetMode.RandomInRoom;
            }
            // Front
            else if (targeting == 1)
            {
                collector.targetMode = TargetMode.FrontInRoom;
            }
            // Everyone
            else
            {
                collector.targetMode = TargetMode.Room;
            }

            TargetHelper.CollectTargets(collector, ref targets);
            //int statCount = Math.Min(count, flatIncrease);

            foreach (var target in targets)
            {
                if (statCount > 0)
                {
                    target.AddStatusEffect(statusId, statCount);
                }
            }
        }