Exemplo n.º 1
0
        public static CompanionCharacterObject CreateCompanionCharacterObject(CompanionDefinition definition, int x, int y, Direction direction)
        {
            //IL_0067: Unknown result type (might be due to invalid IL or missing references)
            //IL_006c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0082: Unknown result type (might be due to invalid IL or missing references)
            //IL_0083: Unknown result type (might be due to invalid IL or missing references)
            if (null == s_instance)
            {
                Log.Error("CreateCompanionCharacterObject called while the factory is not ready.", 206, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                return(null);
            }
            if (!FightMap.current.TryGetCellObject(x, y, out CellObject cellObject))
            {
                Log.Error(string.Format("{0} called with an invalid position {1}, {2}.", "CreateCompanionCharacterObject", x, y), 215, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                return(null);
            }
            Transform transform = cellObject.get_transform();
            Vector3   position  = transform.get_position();

            position.y += 0.5f;
            CompanionCharacterObject component = s_companionCharacterPool.Instantiate(position, Quaternion.get_identity(), transform).GetComponent <CompanionCharacterObject>();

            component.InitializeDefinitionAndArea(definition, x, y);
            component.SetCellObject(cellObject);
            component.direction = direction;
            return(component);
        }
Exemplo n.º 2
0
 public ReserveCompanionStatus(PlayerStatus ownerPlayer, CompanionDefinition definition, int level)
 {
     this.ownerPlayer = ownerPlayer;
     this.definition  = definition;
     this.level       = level;
     m_currentPlayer  = ownerPlayer;
 }
 protected override void Clear()
 {
     m_definition = null;
     SetIllustration(null);
     SetCost();
     SetUsable(IsAvailable(), instant: true, force: true);
 }
        public void Set(ReserveCompanionStatus companion)
        {
            ReserveCompanionValueContext reserveCompanionValueContext = companion.CreateValueContext();

            m_definition           = companion.definition;
            m_tooltipValueProvider = new FightValueProvider(companion);
            m_life           = m_definition.life.GetValueWithLevel(reserveCompanionValueContext.level);
            m_movementPoints = m_definition.movementPoints.GetValueWithLevel(reserveCompanionValueContext.level);
            m_actionValue    = ExtractActionValue(m_definition, reserveCompanionValueContext);
            ApplyIllu(companion.currentPlayer.isLocalPlayer);
        }
Exemplo n.º 5
0
        public static CompanionStatus Create(int id, [NotNull] CompanionDefinition definition, int level, PlayerStatus owner, Vector2Int position)
        {
            //IL_001b: Unknown result type (might be due to invalid IL or missing references)
            int             id2       = owner.id;
            int             teamId    = owner.teamId;
            int             teamIndex = owner.teamIndex;
            Area            area      = definition.areaDefinition.ToArea(position);
            CompanionStatus obj       = new CompanionStatus(id, id2, teamId, teamIndex, level)
            {
                area       = area,
                definition = definition
            };

            CharacterStatus.InitializeStatus(obj, definition);
            return(obj);
        }
 private void SetIllustration(CompanionDefinition definition)
 {
     //IL_000a: Unknown result type (might be due to invalid IL or missing references)
     //IL_000f: Unknown result type (might be due to invalid IL or missing references)
     //IL_002d: Unknown result type (might be due to invalid IL or missing references)
     if (!(definition == null))
     {
         AssetReference illustrationReference = definition.illustrationReference;
         if (illustrationReference.get_hasValue())
         {
             m_companionImage.Setup(definition.illustrationReference, definition.illustrationBundleName);
             return;
         }
     }
     m_companionImage.Clear();
 }
Exemplo n.º 7
0
        public static IEnumerator CreateCompanionCharacterObject(FightStatus fightStatus, CompanionStatus companionStatus, PlayerStatus ownerStatus, int x, int y, Direction direction)
        {
            CompanionDefinition companionDefinition = (CompanionDefinition)companionStatus.definition;

            if (!(null == companionDefinition))
            {
                CompanionCharacterObject companionCharacterObject = FightObjectFactory.CreateCompanionCharacterObject(companionDefinition, x, y, direction);
                if (!(null == companionCharacterObject))
                {
                    companionStatus.view = companionCharacterObject;
                    yield return(companionCharacterObject.LoadAnimationDefinitions(companionDefinition.defaultSkin.value));

                    companionCharacterObject.Initialize(fightStatus, ownerStatus, companionStatus);
                    yield return(companionCharacterObject.Spawn());
                }
            }
        }
Exemplo n.º 8
0
        public static ITooltipDataProvider Create <T>(T definition, int level) where T : IDefinitionWithTooltip
        {
            SpellDefinition spellDefinition = definition as SpellDefinition;

            if (spellDefinition != null)
            {
                return(Create(spellDefinition, level));
            }
            CompanionDefinition companionDefinition = definition as CompanionDefinition;

            if (companionDefinition != null)
            {
                return(Create(companionDefinition, level));
            }
            SummoningDefinition summoningDefinition = definition as SummoningDefinition;

            if (summoningDefinition != null)
            {
                return(Create(summoningDefinition, level));
            }
            WeaponDefinition weaponDefinition = definition as WeaponDefinition;

            if (weaponDefinition != null)
            {
                return(Create(weaponDefinition, level));
            }
            FloorMechanismDefinition floorMechanismDefinition = definition as FloorMechanismDefinition;

            if (floorMechanismDefinition != null)
            {
                return(Create(floorMechanismDefinition, level));
            }
            ObjectMechanismDefinition objectMechanismDefinition = definition as ObjectMechanismDefinition;

            if (objectMechanismDefinition != null)
            {
                return(Create(objectMechanismDefinition, level));
            }
            ReserveDefinition reserveDefinition = definition as ReserveDefinition;

            if (reserveDefinition != null)
            {
                return(Create(reserveDefinition, level));
            }
            throw new ArgumentOutOfRangeException();
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
        protected void SetValue(CompanionDefinition definition, int level)
        {
            CompanionDefinition definition2 = m_definition;

            m_definition = definition;
            m_level      = level;
            if (definition != definition2)
            {
                SetIllustration(definition);
                SetCost();
                SetUsable(IsAvailable(), instant: true, force: true);
            }
            if (definition != null)
            {
                m_valueProvider = new FightValueProvider(definition, level);
                m_context       = new CompanionDefinitionContext(definition, level);
            }
            else
            {
                m_valueProvider = null;
                m_context       = null;
            }
        }
Exemplo n.º 12
0
 private static ITooltipDataProvider Create(CompanionDefinition companion, int level)
 {
     return(new CharacterTooltipDataProvider <CompanionDefinition>(companion, level));
 }
        protected override IEnumerator LoadIllu(Action <Sprite, string> loadEndCallback)
        {
            CompanionDefinition definition = m_definition;

            yield return(definition.LoadIllustrationAsync <Sprite>(definition.illustrationBundleName, definition.illustrationReference, loadEndCallback));
        }
 private static int?ExtractActionValue(CompanionDefinition definition, DynamicValueContext context)
 {
     return(definition.actionValue?.GetValueWithLevel(context.level));
 }
Exemplo n.º 15
0
 public static string GetUICharacterResourcesBundleName(CompanionDefinition definition)
 {
     return("core/ui/characters/companions");
 }