예제 #1
0
        private static bool HasCompanionValidTargets(PlayerStatus casterStatus, ReserveCompanionStatus companionStatus)
        {
            CompanionDefinition definition = companionStatus.definition;

            if (null == definition)
            {
                return(false);
            }
            OneCastTargetContext context = new OneCastTargetContext(FightStatus.local, casterStatus.id, DynamicValueHolderType.Companion, definition.get_id(), companionStatus.level, 0);
            FightMap             current = FightMap.current;

            if (null == current)
            {
                return(false);
            }
            return(definition.spawnLocation?.EnumerateCoords(context).GetEnumerator().MoveNext() ?? false);
        }
예제 #2
0
        public static bool StartInvokingCompanion(PlayerStatus casterStatus, ReserveCompanionStatus companionStatus)
        {
            if (s_currentCastType != 0)
            {
                Log.Error($"Tried to start invoking a companion while current cast type is {s_currentCastType}", 208, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs");
                return(false);
            }
            CompanionDefinition definition = companionStatus.definition;

            if (null == definition)
            {
                Log.Error("Tried to start invoking a companion without a loaded definition.", 215, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs");
                return(false);
            }
            OneCastTargetContext castTargetContext = new OneCastTargetContext(FightStatus.local, casterStatus.id, DynamicValueHolderType.Companion, definition.get_id(), companionStatus.level, 0);
            FightMap             current           = FightMap.current;

            if (null != current)
            {
                ICoordSelector spawnLocation = definition.spawnLocation;
                if (spawnLocation == null)
                {
                    Log.Error("Tried to start invoking a companion that has no spawn location.", 227, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightCastManager.cs");
                    return(false);
                }
                FightMap fightMap = current;
                fightMap.onTargetChanged = (Action <Target?, CellObject>)Delegate.Combine(fightMap.onTargetChanged, new Action <Target?, CellObject>(OnCompanionInvocationLocationChanged));
                FightMap fightMap2 = current;
                fightMap2.onTargetSelected = (Action <Target?>)Delegate.Combine(fightMap2.onTargetSelected, new Action <Target?>(OnCompanionInvocationLocationSelected));
                current.SetTargetingPhase(EnumerateCompanionAvailableLocations(spawnLocation, castTargetContext));
            }
            s_currentCastType       = CurrentCastType.Companion;
            s_playerCasting         = casterStatus;
            s_companionBeingInvoked = companionStatus;
            s_castTargetContext     = castTargetContext;
            ShowCompanionCostsPreview();
            return(true);
        }