예제 #1
0
    public void Read(BinaryReader br)
    {
        Status          = (HeroStatus)br.ReadInt32();
        MissingDuration = br.ReadInt32();
        InActivity      = br.ReadString();
        Trait           = br.ReadString();
        RosterId        = br.ReadInt32();
        Name            = br.ReadString();
        HeroClass       = br.ReadString();

        ResolveLevel = br.ReadInt32();
        ResolveXP    = br.ReadInt32();
        CurrentHp    = br.ReadSingle();
        StressLevel  = br.ReadSingle();

        WeaponLevel    = br.ReadInt32();
        ArmorLevel     = br.ReadInt32();
        LeftTrinketId  = br.ReadString();
        RightTrinketId = br.ReadString();

        Quirks.Read(br);
        Buffs.Read(br);
        SelectedCombatSkillIndexes.Read(br);
        SelectedCampingSkillIndexes.Read(br);
    }
예제 #2
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            MonoBehaviour monoBehaviour = Main.monoBehaviour;
            List <IEntityWithBoardPresence> removedEntities = m_removedEntities;
            int count = removedEntities.Count;

            for (int i = 0; i < count; i++)
            {
                IEntityWithBoardPresence entity = removedEntities[i];
                MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, RemoveEntityFromBoard(entity), null);
            }
            if (GameStatus.fightType == FightType.BossFight && fightStatus.endReason == FightStatusEndReason.Lose)
            {
                FightMap current = FightMap.current;
                if (null != current)
                {
                    if (fightStatus.TryGetEntity((PlayerStatus p) => p.teamIndex == GameStatus.localPlayerTeamIndex, out PlayerStatus entityStatus))
                    {
                        HeroStatus heroStatus = entityStatus.heroStatus;
                        if (heroStatus != null)
                        {
                            Vector2Int refCoord = heroStatus.area.refCoord;
                            current.AddHeroLostFeedback(refCoord);
                        }
                    }
                    MonoBehaviourExtensions.StartCoroutineImmediateSafe(monoBehaviour, current.ClearMonsterSpawnCells(fightStatus.fightId), null);
                }
            }
            if (fightStatus == FightStatus.local && !GameStatus.hasEnded)
            {
                yield return(DisplayFightResultFeedback(fightStatus));
            }
        }
예제 #3
0
파일: Hero.cs 프로젝트: PaiLv99/2DPortfolio
    public void Init(Data.HeroData info)
    {
        _animator = GetComponent <Animator>();

        if (_status == null)
        {
            _status = new HeroStatus(info);
        }

        Death += () => GameMng.Camera.SetCameraMode(Define.CameraMode.None);
        Death += () => GameMng.Input.TouchAction -= OnTouch;
        Death += DeathEffect;
        Death += () => Destroy(this.gameObject);

        ItemMng.Instance.SetStatus(_status);

        GameMng.Input.TouchAction -= OnTouch;
        GameMng.Input.TouchAction += OnTouch;
        _status.StartEquip();

        UIMng.Instance.CallEvent(UIList.HUD, "RegistHero", this);
        FoV fov = new FoV(GameMng.Map.CurrMap, _radius);

        _fov = fov;
    }
예제 #4
0
        private HeroStatus CheckIfInAdventure(int VillageID)
        {
            TVillage CV = TD.Villages[VillageID];

            HeroStatus status = HeroStatus.HERO_NOT_BELONG_HERE;

            foreach (TTInfo info in CV.Troop.Troops)
            {
                if (info.OwnerVillageZ != CV.Z || info.Troops[10] != 1)
                {
                    continue;
                }
                if (TD.Adv_Sta.HeroLocate != VillageID)
                {
                    TD.Adv_Sta.HeroLocate = VillageID;
                    DebugLog("探测到英雄所在村,更正为:" + CV.Name
                             + "(" + VillageID.ToString() + ")", DebugLevel.II);
                }
                if (info.VillageName.Contains("英雄冒险") &&
                    info.TroopType == TTroopType.Outgoing)
                {
                    status = HeroStatus.HERO_IN_ADVANTURE;
                }
                else
                {
                    status = HeroStatus.HERO_NOT_IN_ADVANTURE;
                }
                break;
            }
            return(status);
        }
예제 #5
0
 public void SetupReserve(HeroStatus heroStatus, ReserveDefinition definition)
 {
     if (null != m_reservePointCounter)
     {
         m_reservePointCounter.Setup(heroStatus, definition);
     }
 }
예제 #6
0
    public int PlayerJoined(HeroStatus hero)
    {
        player[playerCount] = hero;

        playerCount ++;
        return playerCount;
    }
예제 #7
0
        private static CastValidity ComputeCastValidity(ICastableStatus status)
        {
            PrecomputedData precomputedData = status.GetDefinition()?.precomputedData;
            FightStatus     local           = FightStatus.local;

            if (precomputedData != null && local != null)
            {
                PlayerStatus     player           = local.GetLocalPlayer();
                HeroStatus       heroStatus       = player.heroStatus;
                WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                if (precomputedData.checkNumberOfSummonings)
                {
                    int num            = local.EnumerateEntities((SummoningStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel = weaponDefinition.maxSummoningsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num >= valueWithLevel)
                    {
                        return(CastValidity.TOO_MANY_SUMMONING);
                    }
                }
                if (precomputedData.checkNumberOfMechanisms)
                {
                    int num2            = local.EnumerateEntities((MechanismStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel2 = weaponDefinition.maxMechanismsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num2 >= valueWithLevel2)
                    {
                        return(CastValidity.TOO_MANY_MECHANISM);
                    }
                }
            }
            return(CastValidity.SUCCESS);
        }
예제 #8
0
    public void SetStatus(HeroStatus status)
    {
        if (Hero == null)
        {
            return;
        }

        if (Hero.Status == HeroStatus.RaidParty && status != HeroStatus.RaidParty)
        {
            Hero.Status = status;
            if (PartySlot != null)
            {
                PartySlot.ItemDroppedOut(this);
            }
        }
        Hero.Status = status;

        switch (Hero.Status)
        {
        case HeroStatus.Abbey:
            portrait.material = DarkestDungeonManager.GrayDarkMaterial;
            statusIcon.gameObject.SetActive(true);
            statusIcon.sprite = DarkestDungeonManager.Data.Sprites["abbey.icon_roster"];
            break;

        case HeroStatus.Sanitarium:
            portrait.material = DarkestDungeonManager.GrayDarkMaterial;
            statusIcon.gameObject.SetActive(true);
            statusIcon.sprite = DarkestDungeonManager.Data.Sprites["sanitarium.icon_roster"];
            break;

        case HeroStatus.Tavern:
            portrait.material = DarkestDungeonManager.GrayDarkMaterial;
            statusIcon.gameObject.SetActive(true);
            statusIcon.sprite = DarkestDungeonManager.Data.Sprites["tavern.icon_roster"];
            break;

        case HeroStatus.Missing:
            portrait.material = DarkestDungeonManager.GrayDarkMaterial;
            statusIcon.gameObject.SetActive(true);
            statusIcon.sprite = DarkestDungeonManager.Data.Sprites["missing.icon_roster"];
            break;

        case HeroStatus.RaidParty:
            portrait.material = portrait.defaultMaterial;
            statusIcon.gameObject.SetActive(true);
            statusIcon.sprite = DarkestDungeonManager.Data.Sprites["party.icon_roster"];
            break;

        case HeroStatus.Available:
            portrait.material = portrait.defaultMaterial;
            statusIcon.gameObject.SetActive(false);
            break;

        default:
            statusIcon.gameObject.SetActive(false);
            portrait.material = portrait.defaultMaterial;
            break;
        }
    }
예제 #9
0
파일: HUD.cs 프로젝트: PaiLv99/2DPortfolio
 private void RegistHero(Hero hero)
 {
     _status           = hero.GetStatus();
     _statImage.sprite = _status.STATUSSPRITE;
     UpdateHP();
     UpdateEXP();
     UpdateLevel();
 }
예제 #10
0
        public void Set(PlayerStatus status, int valueBefore)
        {
            m_reserveDefinition = RuntimeDataHelper.GetReserveDefinitionFrom(status);
            HeroStatus heroStatus = status.heroStatus;

            m_tooltipValueProvider = new FightValueProvider(m_reserveDefinition, heroStatus.level);
            m_valueText.text       = valueBefore.ToString();
            ApplyIllu(status.isLocalPlayer);
        }
예제 #11
0
 public void ResetStatus()
 {
     if (status == null)
     {
         status = new HeroStatus();
     }
     status.hp     = hero.hp;
     status.isDead = false;
     status.pow    = 50;
 }
예제 #12
0
 public void enableStatus(string key, HeroStatus status)
 {
     if (!mStatus.ContainsKey(key))
     {
         mStatus[key] = status;
     }
     else
     {
         mStatus[key].time += status.time;
     }
 }
예제 #13
0
 /// <summary>
 /// 检查是否存在PlayerStatus
 /// </summary>
 private void Awake()
 {
     if (heroStatus != null)
     {
         Destroy(heroStatus);
     }
     else
     {
         heroStatus = this;
     }
     DontDestroyOnLoad(this);
 }
예제 #14
0
    public SaveHeroData()
    {
        status     = HeroStatus.Available;
        inActivity = "";
        trait      = "";

        quirks = new List <QuirkInfo>();
        buffs  = new List <BuffInfo>();

        selectedCombatSkillIndexes  = new List <int>();
        selectedCampingSkillIndexes = new List <int>();

        currentHp = 1000;
    }
예제 #15
0
    private void PopUp()
    {
        if (_status == null)
        {
            _status = GameMng.CharMng.GetHero().GetStatus();
        }

        _level.text          = string.Format("레벨\t{0}", _status.LEVEL.ToString());
        _hp.text             = string.Format("체력\t{0}/{1}", _status.HP.ToString(), _status.MAXHP.ToString());
        _exp.text            = string.Format("경험치\t{0}/{1}", _status.EXP.ToString(), _status.MAXEXP.ToString());
        _attackPower.text    = string.Format("공격력\t{0}", _status.AP.ToString());
        _defensivePower.text = string.Format("방어력\t{0}", _status.DP.ToString());
        _heroIcon.sprite     = _status.SPRITE;
        _name.text           = _status.Data._uiName;
    }
예제 #16
0
파일: Hero.cs 프로젝트: 1010MMR/Portfolio
    public void Init(HeroBaseInfo info, TowerPlaceToken token)
    {
        if (gameObject.activeSelf == false)
        {
            gameObject.SetActive(true);
        }

        StopAllCoroutines();

        gameObject.transform.localPosition = new Vector3(0, token.obj.transform.localPosition.y);
        status = new HeroStatus(this, token.FloorIndex, info);

        token.AddPlacedHero(this);

        StartCoroutine("Process");
    }
예제 #17
0
        public static ReserveDefinition GetReserveDefinitionFrom([NotNull] PlayerStatus playerStatus)
        {
            HeroStatus heroStatus = playerStatus.heroStatus;

            if (heroStatus == null)
            {
                return(null);
            }
            Dictionary <God, ReserveDefinition> reserveDefinitions = RuntimeData.reserveDefinitions;
            God god = ((WeaponDefinition)heroStatus.definition).god;

            if (reserveDefinitions.TryGetValue(god, out ReserveDefinition value))
            {
                return(value);
            }
            return(null);
        }
예제 #18
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         IObjectWithArmoredLife objectWithArmoredLife;
         if ((objectWithArmoredLife = (entityStatus.view as IObjectWithArmoredLife)) != null)
         {
             objectWithArmoredLife.SetBaseLife(maxLifeAfter);
         }
         else
         {
             Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 37, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
         }
         if (entityStatus.type == EntityType.Hero)
         {
             HeroStatus heroStatus = (HeroStatus)entityStatus;
             if (heroStatus.ownerId == fightStatus.localPlayerId)
             {
                 FightMap current = FightMap.current;
                 if (null != current)
                 {
                     current.SetLocalPlayerHeroLife(heroStatus.life, maxLifeAfter);
                 }
             }
             if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
             {
                 AbstractPlayerUIRework view = entityStatus2.view;
                 if (null != view)
                 {
                     view.ChangeHeroBaseLifePoints(maxLifeAfter);
                 }
             }
             else
             {
                 Log.Error(FightEventErrors.PlayerNotFound(heroStatus.ownerId), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
             }
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\MaxLifeChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.LifeArmorChanged);
     yield break;
 }
예제 #19
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     //IL_0046: Unknown result type (might be due to invalid IL or missing references)
     if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
     {
         Gender gender = (Gender)this.gender;
         if (RuntimeData.weaponDefinitions.TryGetValue(entityDefId, out WeaponDefinition value))
         {
             HeroStatus heroStatus = HeroStatus.Create(concernedEntity, value, level, gender, entityStatus, (Vector2Int)refCoord);
             fightStatus.AddEntity(heroStatus);
             entityStatus.heroStatus = heroStatus;
             AbstractPlayerUIRework view = entityStatus.view;
             if (null != view)
             {
                 view.SetHeroIllustration(value, gender);
                 view.SetHeroStartLifePoints(heroStatus.baseLife, entityStatus.playerType);
                 if (RuntimeData.reserveDefinitions.TryGetValue(value.god, out ReserveDefinition value2))
                 {
                     view.SetupReserve(heroStatus, value2);
                 }
                 else
                 {
                     Log.Error(FightEventErrors.DefinitionNotFound <ReserveDefinition>((int)value.god), 45, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
                 }
             }
         }
         else
         {
             Log.Error(FightEventErrors.EntityCreationFailed <HeroStatus, WeaponDefinition>(concernedEntity, entityDefId), 51, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 56, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\HeroAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
예제 #20
0
 private void Awake()
 {
     m_Hero = GetComponent<HeroStatus>();
     m_AnimationController = GetComponent<AnimationController>();
 }
예제 #21
0
 public MoneyArgs()
 {
     Mode   = ShareMode.ToAll;
     Status = HeroStatus.All;
     Amount = new DnD.Pouch();
 }
예제 #22
0
 private void Awake()
 {
     m_Hero = GetComponent<HeroStatus>();
     lastPosition = transform.position;
     lastDirectionPosition = transform.position;
 }
예제 #23
0
    void Start()
    {
        _heroStatus = GameManager.Instance.GetHeroStatus();

        DontDestroyOnLoad(this.gameObject);
    }
 public ServerHeroSelectResponsePacket(HeroStatus heroStatus)
 {
     Status = heroStatus;
 }
예제 #25
0
파일: Hero.cs 프로젝트: 1010MMR/Portfolio
 void OnDestroy()
 {
     spriteAnimator = null;
     status         = null;
 }
예제 #26
0
 public void enableStatus(string key, HeroStatus status)
 {
     if (!mStatus.ContainsKey(key))
     {
         mStatus[key] = status;
     }
     else
     {
         mStatus[key].time += status.time;
     }
 }
예제 #27
0
 private void Awake()
 {
     heroStatus = HeroStatus.Instance;
 }
예제 #28
0
 private void Start()
 {
     _heroStatus = new HeroStatus(100, 50);
 }
예제 #29
0
 private void Awake()
 {
     instance = this;
     UpdateAttribute();
 }
 public ServerHeroCreateResponsePacket(HeroStatus heroStatus)
 {
     Status = heroStatus;
 }
예제 #31
0
 public void SetStatus(HeroStatus status)
 {
     _status = status;
 }
예제 #32
0
 public void Setup(HeroStatus heroStatus, ReserveDefinition reserveDefinition)
 {
     m_reserveDefinition  = reserveDefinition;
     m_fightValueProvider = new DynamicFightValueProvider(heroStatus, heroStatus.level);
 }
예제 #33
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            int fightId = fightStatus.fightId;

            if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
            {
                int change = 0;
                int num    = 0;
                int num2   = 0;
                LifeModificationType lifeModificationType = LifeModificationType.Undefined;
                if (armorAfter.HasValue)
                {
                    num = armorAfter.Value;
                    if (armorBefore.HasValue)
                    {
                        int value = armorBefore.Value;
                        change += num - value;
                        if (value > num)
                        {
                            lifeModificationType = LifeModificationType.Damage;
                        }
                        else if (value < num)
                        {
                            lifeModificationType = LifeModificationType.ArmorGain;
                        }
                    }
                }
                if (lifeAfter.HasValue)
                {
                    num2 = lifeAfter.Value;
                    if (lifeBefore.HasValue)
                    {
                        int value2 = lifeBefore.Value;
                        change += num2 - value2;
                        if (value2 > num2)
                        {
                            lifeModificationType = ((num2 > 0) ? LifeModificationType.Damage : LifeModificationType.Death);
                        }
                        else if (value2 < num2)
                        {
                            lifeModificationType = ((entityStatus.type == EntityType.ObjectMechanism) ? LifeModificationType.ArmorGain : LifeModificationType.Heal);
                        }
                    }
                }
                if (lifeAfter.HasValue && entityStatus.type == EntityType.Hero)
                {
                    HeroStatus heroStatus = (HeroStatus)entityStatus;
                    if (heroStatus.ownerId == fightStatus.localPlayerId)
                    {
                        FightMap current = FightMap.current;
                        if (null != current)
                        {
                            current.SetLocalPlayerHeroLife(num2, heroStatus.baseLife);
                        }
                    }
                    if (fightStatus.TryGetEntity(heroStatus.ownerId, out PlayerStatus entityStatus2))
                    {
                        AbstractPlayerUIRework view = entityStatus2.view;
                        if (null != view)
                        {
                            view.ChangeHeroLifePoints(num2);
                        }
                        TryDrawLowLifeMessage(num2, entityStatus2);
                    }
                }
                IsoObject isoObject = entityStatus.view;
                if (null != isoObject)
                {
                    IObjectWithArmoredLife objectWithArmoredLife2;
                    IObjectWithArmoredLife objectWithArmoredLife = objectWithArmoredLife2 = (isoObject as IObjectWithArmoredLife);
                    if (objectWithArmoredLife2 != null)
                    {
                        int life  = lifeAfter.HasValue ? num2 : objectWithArmoredLife.life;
                        int armor = armorAfter.HasValue ? num : objectWithArmoredLife.armor;
                        objectWithArmoredLife.SetArmoredLife(life, armor);
                    }
                    else
                    {
                        Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithArmoredLife>(entityStatus), 151, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                        objectWithArmoredLife = null;
                    }
                    switch (lifeModificationType)
                    {
                    case LifeModificationType.ArmorGain:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.ArmorGain, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Damage:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        if (objectWithArmoredLife != null)
                        {
                            yield return(objectWithArmoredLife.Hit(isoObject.area.refCoord));
                        }
                        break;

                    case LifeModificationType.Heal:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Heal, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Heal, isoObject.cellObject.get_transform());
                        break;

                    case LifeModificationType.Death:
                        yield return(FightSpellEffectFactory.PlayGenericEffect(SpellEffectKey.Damage, fightId, parentEventId, isoObject, fightStatus.context));

                        ValueChangedFeedback.Launch(change, ValueChangedFeedback.Type.Damage, isoObject.cellObject.get_transform());
                        objectWithArmoredLife?.LethalHit(isoObject.area.refCoord);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();

                    case LifeModificationType.Undefined:
                        break;
                    }
                }
                else
                {
                    Log.Error(FightEventErrors.EntityHasNoView(entityStatus), 197, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 202, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ArmoredLifeChangedEvent.cs");
            }
            FightLogicExecutor.FireUpdateView(fightId, EventCategory.LifeArmorChanged);
        }