private IEnumerator DamageImunity()
    {
        isImune = true;
        yield return(new WaitForSeconds(HeroCharacter.GetInstance().ImunityDuration));

        isImune = false;
    }
Beispiel #2
0
 public Hero(HeroCharacter character, RuntimeDeck deck)
 {
     this.character = character;
     this.deck      = deck;
     missingHp      = 0;
     equipment      = new HeroEquipment(character.Class);
 }
 override public void Use(Characters character)
 {
     HeroCharacter.PlayEffect("Способность - рассечь");
     print("Slash применен!!!");
     character.TakeDamage(power * damage);
     HeroCharacter.SetReload(reloadtime);
 }
Beispiel #4
0
 public void Select(HeroCharacter c)
 {
     currentHero        = c;
     heroBust.sprite    = c.Bust;
     heroName.text      = c.Name;
     heroClassName.text = c.Class.Name;
 }
    /// <summary>
    /// Looks for player.
    /// </summary>
    protected void LookForPlayer()
    {
        //Only check for player every so often to save resources
        if (bHuntPulse)
        {
            Collider[] cols            = Physics.OverlapSphere(transform.position, fHuntingRadius, PLAYER_LAYER);
            float      closestDistance = 9999f;
            int        index           = 0;

            //finds nearest player and target it
            for (int i = 0; i < cols.Length; i++)
            {
                float dist = Vector3.Distance(cols[i].transform.position, transform.position);
                if (dist < closestDistance)
                {
                    closestDistance = dist;
                    index           = i;
                }
            }
            if (cols.Length == 0)
            {
                return;
            }

            try
            {
                hcTargetHero = cols[index].GetComponent <HeroCharacter>();
            }
            catch (System.Exception ex)
            {
                Debug.LogError("Object is using the PLAYER_LAYER without having the correct class attached.", cols[index].gameObject);
                Debug.LogError(ex.Message);
            }
        }
    }
    private void SetupHero(GameObject heroOrigin, HeroCharacter hero, int visualOrder)
    {
        var hasBody = !hero.Body.name.Equals("BodyPlaceholder");

        if (hasBody)
        {
            var character = Instantiate(hero.Body, heroOrigin.transform.position, Quaternion.identity, heroOrigin.transform);
            _heroes.Add(character);
            _animators[hero] = character.GetComponentInChildren <Animator>();

            var damageEffects = character.GetComponentsInChildren <DamageEffect>();
            if (damageEffects.Length < 2)
            {
                Debug.LogWarning($"{hero.Name} is missing one or more text DamageEffects");
            }
            else
            {
                _damage[hero] = damageEffects;
            }

            character.GetComponentInChildren <SpriteRenderer>().sortingOrder = visualOrder;
        }
        else
        {
            heroOrigin.GetComponent <SpriteRenderer>().sprite = hero.Bust;
        }
    }
Beispiel #7
0
 void Start()
 {
     stateMachine = GetComponent <StateMachine>();
     levelUp      = GetComponent <LevelUp>();
     currentState = BattleStates.START;
     hero         = GetComponent <HeroCharacter>();
 }
 public void Init(HeroCharacter h)
 {
     _hero     = h;
     _healCost = party.CurrentHpOf(_hero) > 0 ? cost : reviveCost;
     gameObject.SetActive(party.CurrentHpOf(_hero) < _hero.Stats.MaxHp());
     costLabel.text = $"Heal - {_healCost}";
 }
Beispiel #9
0
    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];

        /*
        // ddong
        if (stageId < 2000)
        {
            stageId += 2000;
        }
        */

        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        field = CreateField(stageEntity, fieldArea, timeClient, fsm);

        // ddong
        int subClassCode = 11;
        int level = 1;
        int trainLevel = 1;

        this.subClassEntity = TableLoader.GetTable<SubClassEntity>().Get(subClassCode);
        ClassLevelEntity levelEntity = TableLoader.GetTable<ClassLevelEntity>().Get(subClassEntity.classCode, level);
        TrainLevelEntity trainLevelEntity = TableLoader.GetTable<TrainLevelEntity>().Get(subClassEntity.classCode, trainLevel);
        FieldObjectEntity objectField = TableLoader.GetTable<FieldObjectEntity>().Get(subClassEntity.objectCode);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(puzzleArea, timeClient, subClassCode, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(objectField, levelEntity, trainLevelEntity, subClassEntity, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon, fsm);
        itemDropManager = new ConsumableSpawn(stageEntity.gameModeCode, levelEntity.consumableTier);

        Func<float> getLifeDrainRate = (() => gameEntity.defaultHP);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        /*
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
        */

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        var screenPosTable = TableLoader.GetTable<ScreenPositionEntity2>();
        var hpToPos = screenPosTable.Values.Select(x => new KeyValuePair<float, float>(x.hp, x.screenPos));
        convertHPRatioToScreenPos = new RangeConvertor(hpToPos).Convert;

        SetFocusTarget(heroCharacter);
    }
Beispiel #10
0
 void BindToHandlers()
 {
     HeroCharacter.GetInstance().HeroStateHandler.onTakeDamageCallBack += UpdateHealth;
     HeroCharacter.GetInstance().HeroStateHandler.onTakeDamageCallBack += DamageCameraShake;
     HeroCharacter.GetInstance().HeroStateHandler.onHealingCallBack += UpdateHealth;
     InputHandler.MenuController.onPause += ShowPause;
 }
Beispiel #11
0
 public void InitCommendSlots(FSM targetFsm, HeroCharacter heroCharacter)
 {
     itemSlotDisplay.Init(targetFsm, heroCharacter);
     /*
     skillDisplay.Init(targetFsm, heroCharacter);
      */
 }
 protected override void Awake()
 {
     heroStateHandler = GetComponent <HeroCharacterStateHandler>();
     heroStateHandler.onTakeDamage += CalculateHealth;
     heroStateHandler.onHealing    += CalculateHealth;
     instance   = this;
     fMaxHealth = maxHeartPiecesCount * 30;
 }
 override public void Use(Characters character)
 {
     base.Use(character);
     HeroCharacter.PlayEffect("Способность - рассечь");
     print("Slash применен!!!");
     character.TakeDamage(Information.GetSpellStates("Рассечь", level, power)[0]);
     HeroCharacter.SetReload(reloadtime);
 }
 protected override void VisualFeedBack(HeroCharacter hero)
 {
     base.VisualFeedBack(hero);
     feedback = Instantiate(feedback, hero.transform.position, hero.transform.rotation) as GameObject;
     feedback.transform.SetParent(hero.transform);
     feedback.transform.localPosition = Vector3.zero;
     Destroy(feedback, FEEDBACK_DURATION);
 }
Beispiel #15
0
    private void Start()
    {
        dis = healthBar.GetComponent <Transform>().position.x - barReference.GetComponent <Transform>().position.x;

        barPos = healthBar.GetComponent <Transform>().position;

        heroCharacter = GameObject.FindGameObjectWithTag("Hero").GetComponent <HeroCharacter>();
    }
Beispiel #16
0
 public PlayerCharacter(InGameUser user, HeroCharacter heroCharacter, Func<float> getLifeDrainRate, FSM parentFsm)
 {
     this.user = user;
     this.heroCharacter = heroCharacter;
     this.getLifeDrainRate = getLifeDrainRate;
     this.parentFsm = parentFsm;
     heroCharacter.InitFSM("PlayerCharacter.fsm", this, false);
 }
 private void Start()
 {
     mRenderers = GetComponentsInChildren <MeshRenderer>();
     foreach (var mrender in mRenderers)
     {
         mrender.material = Instantiate(mrender.material) as Material;
     }
     HeroCharacter.GetInstance().HeroStateHandler.onHitImunityCallback += Blink;
 }
 override public void Use(Characters character)
 {
     HeroCharacter.PlayEffect("Блок");
     print("Прикрытие");
     var st = Instantiate(status, character.transform);
     st.lifetime = 8f * power;
     st.character = character;
     HeroCharacter.SetReload(reloadtime);
 }
Beispiel #19
0
    override public void Use(Characters character)
    {
        var st = Instantiate(VS, character.transform);

        st.character = character;
        st.mult      = 1.6f;
        st.lifetime  = 10f;
        HeroCharacter.SetReload(reloadtime);
    }
Beispiel #20
0
    override public void Use(Characters character)
    {
        print("Зелье Дьявола");
        var st = Instantiate(status, character.transform);

        st.lifetime  = 8f * power;
        st.character = character;
        HeroCharacter.SetReload(reloadtime);
    }
Beispiel #21
0
    public void Destroy()
    {
        box.Destroy();

        if (heroCharacter != null)
        {
            heroCharacter.Destroy();
            heroCharacter = null;
        }
    }
Beispiel #22
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Player")
     {
         HeroCharacter hero = col.GetComponent <HeroCharacter>();
         Activate(hero);
         VisualFeedBack(hero);
         Destroy(gameObject);
     }
 }
Beispiel #23
0
    private void DamageCameraShake()
    {
        SpringArm.GetInstance().DoShakeCamera(0.5f, 0.1f);
        float intensity = (HeroCharacter.GetInstance().CurrentHealth % 3 == 0) ? 1f : 0.3f;

        //If the heart piece is the last in the container(3 pieces),
        //then the screen flashes with more intensity

        DoFlashOverlay(1f, intensity);
    }
Beispiel #24
0
 public Hero(HeroCharacter _type, HeroName _heroName, int _upsetMentalityThreshold, int _strength, int _mentality, bool _injured, int _eventsInjured)
 {
     type     = _type;
     heroName = _heroName;
     upsetMentalityThreshold = _upsetMentalityThreshold;
     strength      = _strength;
     mentality     = _mentality;
     injured       = _injured;
     eventsInjured = _eventsInjured;
 }
Beispiel #25
0
    // Use this for initialization
    void Start()
    {
        herocharacter  = GameObject.Find("Soldier").GetComponent <HeroCharacter>();
        HPber          = GameObject.Find("Progress Bar Hp").GetComponent <Slider>();
        HeadUpPosition = GameObject.Find("Soldier/HeadUpPosition");

        minion          = GameObject.Find("Monster").GetComponent <MinionMonster>();
        MonsterHPber    = GameObject.Find("MonsterHpBar").GetComponent <Slider>();
        MHeadUpPosition = GameObject.Find("MHeadUpPosition");
    }
Beispiel #26
0
    public void Init(FSM targetFsm, HeroCharacter heroCharacter)
    {
        CommandSlot commandSlot = heroCharacter.GetCommandSet("skill") as CommandSlot;
        slot.Init(commandSlot, heroCharacter);
        commandSlot.RegistUI(slot);

        foreach (var entity in slot.GetComponentsInChildren<UIButtonMessage>(true))
        {
            entity.fsm = targetFsm;
        }
    }
    override public void Use(Characters character)
    {
        base.Use(character);
        HeroCharacter.PlayEffect("Шприц");
        var st = Instantiate(status, character.transform);

        st.level     = level;
        st.power     = power;
        st.lifetime  = Information.GetEffectStates("Эйфория", level, power)[1];
        st.character = character;
        HeroCharacter.SetReload(reloadtime);
    }
Beispiel #28
0
    public void AddPlayerCharacter(HeroCharacter heroCharacter)
    {
        this.heroCharacter = heroCharacter;

        Layer playerLayer = box.GetLayer(FieldData.PlayerLayer);
        if (!Constants.Instance.IsEditor)
        {
            playerLayer.SetGuideEnable(false);
        }
        playerLayer.AddSubject(heroCharacter, 0, 0);
        AddFieldInstance(heroCharacter);
    }
    override public void Use(Characters character)
    {
        print("Отравили");
        var st = Instantiate(PS, character.transform);

        st.damage    = damage * power;
        st.lifetime  = 7f;
        st.period    = 1f;
        st.character = character;
        //character.StatusList.Add()
        character.TakeDamage(power * damage);
        HeroCharacter.SetReload(reloadtime);
    }
 override public void Use()
 {
     weekPercent    += (int)(Math.Min(50f, 20f * (power - 1f)));
     fightController = HeroCharacter.fightController;
     foreach (var enemy in fightController.enemies)
     {
         var st = Instantiate(WS, enemy.transform);
         st.weekPercent = weekPercent;
         st.lifetime    = 15f;
         st.character   = enemy;
     }
     HeroCharacter.SetReload(reloadtime);
 }
 public override void DamageCharacter(float damage)
 {
     if (isImune)
     {
         return;
     }
     base.DamageCharacter(damage);
     if (onHitImunityCallback != null)
     {
         onHitImunityCallback(HeroCharacter.GetInstance().ImunityDuration);
         StartCoroutine(DamageImunity());
     }
 }
Beispiel #32
0
 override public void Use(Characters character)
 {
     character.TakeDamage(power * damage);
     HeroCharacter.SetReload(reloadtime);
     fightController = character.fightController;
     foreach (var enemy in fightController.enemies)
     {
         if (enemy != character)
         {
             enemy.TakeDamage(damage / 3 * power);
         }
     }
 }
    override public void Use(Characters character)
    {
        base.Use(character);
        HeroCharacter.PlayEffect("бинт");
        character.TakeHeal(Information.GetSpellStates("Нестандартная медицина", level, power)[0]);
        var st = Instantiate(status, character.transform);

        st.level     = level;
        st.power     = power;
        st.lifetime  = 50;
        st.character = character;
        HeroCharacter.SetReload(reloadtime);
    }
Beispiel #34
0
    override public void Use(Characters character)
    {
        print("Наложили кровотечение");
        var st = Instantiate(PS, character.transform);

        st.damage    = damage * power / 3;
        st.lifetime  = 10f;
        st.period    = 2f;
        st.character = character;
        //character.StatusList.Add()
        character.TakeDamage(power * damage);
        HeroCharacter.SetReload(reloadtime);
    }
Beispiel #35
0
    private int IndexOf(HeroCharacter hero)
    {
        var index = 0;

        for (; index < heroes.Length; index++)
        {
            if (heroes[index].Character.Equals(hero))
            {
                return(index);
            }
        }
        throw new KeyNotFoundException($"Hero {hero.Name} not found in Party");
    }
 // Use this for initialization
 void Start()
 {
     //Very important we instantiate a copy as we do not want to alter the source file
     myAgent = ScriptableObject.Instantiate(EnemyType);
     //Grab all our component
     myAni             = gameObject.GetComponent <Animator>();
     spriteShow        = gameObject.GetComponent <SpriteRenderer>();
     spriteShow.sprite = myAgent.mySprite;
     timer             = Random.Range(0, myAgent.atkTime);
     //Grab hero
     myHero    = FindObjectOfType <HeroCharacter>();
     fullHeath = myAgent.health;
 }
Beispiel #37
0
    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];
        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        itemDropManager = new ItemDropManager(stageEntity.GameModeType, stageEntity.ConsumableTier);
        field = CreateField(stageEntity, fieldArea, timeClient, itemDropManager, fsm);

        // ddong
        CharacterSelect characterSelect = new CharacterSelect()
        {
            heroLevel = SaveData.level,
            heroId = GetClassCode(SaveData.selectClass),
            equipIds = ArrayTool.Create<int>(),
        };
        this.heroEntity = TableLoader.GetTable<ItemHeroEntity>().Get(characterSelect.heroId);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(stageEntity, heroEntity.HeroType, puzzleArea, timeClient, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(characterSelect, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon);
        user.SetCharacter(heroCharacter);
        puzzlePanel.SetOwner(heroCharacter);

        Func<float> getLifeDrainRate = (() => gameEntity.DefaultLifeDrainRate + gameEntity.LifeDrainRateIncrease * timeClient.time);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        SetFocusTarget(heroCharacter);

        // ddong
        CutInStarter = StartCutIn;
    }
Beispiel #38
0
    public ButtonPanel(Rect rect, ItemHeroEntity heroEntity, HeroCharacter heroCharacter, ItemDropManager itemDropManager, int itemDropTier)
    {
        this.controlArea = rect;
        this.heroEntity = heroEntity;
        this.heroCharacter = heroCharacter;
        this.itemDropManager = itemDropManager;
        this.itemDropTier = itemDropTier;

        buttonTypes = new List<object>();
        foreach (var entity in Block.normalBlocks)
        {
            buttonTypes.Add(entity);
        }
        buttonTypes.Add("damage");
        buttonTypes.Add("item");
    }
Beispiel #39
0
    public void Init(FSM targetFsm, HeroCharacter heroCharacter)
    {
        var pairs = EnumerableTool.Combine(slots, heroCharacter.itemSlots);
        pairs.ForEach(delegate(Tuple<UIConsumableSlot, KeyValuePair<string, CommandSet>> entity)
        {
            UIConsumableSlot uiSlot = entity.item1;
            CommandSlot commandSlot = entity.item2.Value as CommandSlot;
            uiSlot.Init(commandSlot, heroCharacter);
            commandSlot.RegistUI(uiSlot);

            foreach (var buttonMessage in uiSlot.GetComponentsInChildren<UIButtonMessage>(true))
            {
                buttonMessage.fsm = targetFsm;
            }
        });
    }
Beispiel #40
0
    static SkillCommand InitSkill(HeroCharacter owner, int skillId, int skillLevel)
    {
        SkillEntity skillEntity = TableLoader.GetTable<SkillEntity>().Get(skillId);
        Command.FireCondition skillFirable = delegate(Automaton firer)
        {
            if (skillEntity.bToUsePuzzleActive)
            {
                if (!owner.puzzlePanel.IsReadyToShuffle())
                {
                    return false;
                }
            }
            return owner.Status.Get(Character.MP) >= skillEntity.ManaConsume;
        };

        return new SkillCommand(skillEntity, skillFirable);
    }
Beispiel #41
0
    public ButtonPanel(Rect rect, Dart<BlockEntity2> blockDart, HeroCharacter heroCharacter, ConsumableSpawn itemDropManager, int itemDropTier)
    {
        this.controlArea = rect;
        this.heroCharacter = heroCharacter;
        this.itemDropManager = itemDropManager;
        this.itemDropTier = itemDropTier;

        buttonTypes = new List<object>();
        
        var blocks = blockDart.Values.Where(x => x.blockType != BlockType.WildCard);
        foreach (var entity in blocks)
        {
            buttonTypes.Add(entity);
        }

        buttonTypes.Add("damage");
        buttonTypes.Add("item");
    }
Beispiel #42
0
 public void SetCharacter(HeroCharacter heroCharacter)
 {
     commandQueue.ChangeOwner(heroCharacter);
 }
Beispiel #43
0
    static HeroCharacter CreateCharacter(FieldObjectEntity objectField, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, SubClassEntity subClassEntity, InGameUser user, PuzzlePanel puzzlePanel, ConsumableSpawn itemDropManager, System.Action<StatusEffectEntity2> addBuffIcon, System.Action<StatusEffectEntity2> removeBuffIcon, FSM parentFsm)
    {
        Buff.Handle onBuff = delegate(Buff buff)
        {
            if (addBuffIcon != null)
            {
                addBuffIcon(buff.statusEffectEntity);
            }
        };
        Buff.Handle onDeBuff = delegate(Buff buff)
        {
            if (removeBuffIcon != null)
            {
                removeBuffIcon(buff.statusEffectEntity);
            }
        };
        HeroCharacter heroCharacter = new HeroCharacter(objectField, subClassEntity, levelEntity, trainLevelEntity, false, user, puzzlePanel, onBuff, onDeBuff, parentFsm);

        {
            Action action = ActionPattern.Create("Vector(Self; [HeroStatType.moveSpeed]; 0; 0; false)").Generate(heroCharacter.Stat);
            heroCharacter.Fire(action, null);
            heroCharacter.PauseMoving();
        }

        for (int i = 0; i < 4; i++)
        {
            heroCharacter.AddItemSlot(i, user.commandQueue);
        }

        {
            heroCharacter.AddAction(Action.E_Type.Money,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.Exp,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetConsumable,
                delegate(float value, GameInstance firer, string[] param)
                {
                    if (RandomTool.IsIn(value))
                    {
                        var itemCommand = new ItemCommand(itemDropManager.Pick());
                        if (itemCommand != null)
                        {
                            heroCharacter.TryAddItem(itemCommand);
                        }
                    }
                    return null;
                }
            );
        }

        return heroCharacter;
    }
Beispiel #44
0
 static void RefreshLifePerSecondBuff(HeroCharacter heroCharacter, float lifeChange)
 {
     /*
     var statMod = new Dictionary<System.Enum, float>();
     statMod.Add(HeroStatType.hpPerSecond, lifeChange);
     heroCharacter.Status.AddBuff(new Buff("LifePerSecond", float.MaxValue, statMod));       // LifePerSecond buff is exclusive.
      * */
 }
Beispiel #45
0
    // Returns false if selection is bad
    public bool makeSelectionFromHUD(int row, int col) {
        if (col == 0) {
            selectedCharacter = (HeroCharacter)row;
            selectedAction = HeroAction.Basic;

            selectedTargetId = selectEnemyByLooking();
        }
        else if (col == 1 && row != 2) {
            selectedCharacter = (HeroCharacter)row;
            selectedAction = HeroAction.Special;

            selectedTargetId = selectEnemyByLooking();

            if (!activeHeroes[(int)selectedCharacter].hasEnoughMp()) {
                return false;
            }
        }
        else if (col == 2) {
            selectedCharacter = HeroCharacter.Cadence;
            selectedAction = HeroAction.Special;
            selectedTargetId = row;

            if (!cadenceCombat.hasEnoughMp()) {
                return false;
            }
        }
        else {
            return false;
        }

        if (activeHeroes[(int)selectedCharacter].isDead()) {
            return false;
        }

        return true;
    }
Beispiel #46
0
    static HeroCharacter CreateCharacter(CharacterSelect characterSelect, InGameUser user, PuzzlePanel puzzlePanel, ItemDropManager itemDropManager, System.Action<StatusEffectEntity> addBuffIcon, System.Action<StatusEffectEntity> removeBuffIcon)
    {
        ItemHeroEntity heroEntity = TableLoader.GetTable<ItemHeroEntity>().Get(characterSelect.heroId);
        ObjectField objectField = TableLoader.GetTable<ObjectField>().Get(heroEntity.FieldObject);
        ItemHeroLevel heroLevelEntity = TableLoader.GetTable<ItemHeroLevel>().Get(heroEntity.HeroType, characterSelect.heroLevel);

        Buff.Handle onBuff = delegate(Buff buff)
        {
            if (addBuffIcon != null)
            {
                addBuffIcon(buff.statusEffectEntity);
            }
        };
        Buff.Handle onDeBuff = delegate(Buff buff)
        {
            if (removeBuffIcon != null)
            {
                removeBuffIcon(buff.statusEffectEntity);
            }
        };
        HeroCharacter heroCharacter = new HeroCharacter(objectField, heroEntity, heroLevelEntity, characterSelect.equipIds, false, user, puzzlePanel, onBuff, onDeBuff);

        {
            Action action = ActionPattern.Create("Vector(Self; [WalkSpeed]; 0; 0; false)").Generate(heroCharacter.Stat);
            heroCharacter.Fire(action, null);
            heroCharacter.PauseMoving();
        }

        for (int i = 0; i < 4; i++)
        {
            heroCharacter.AddItemSlot(i, user.commandQueue);
        }

        {
            heroCharacter.AddAction(Action.E_Type.Money,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.Exp,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetKey,
                delegate(float value, GameInstance firer, string[] param)
                {
                    Action action = ActionPattern.Create("Action(User; GetKey; {0})").Generate(heroCharacter.Stat, value);
                    if (action != null)
                    {
                        heroCharacter.Fire(action, null);
                    }
                    return null;
                }
            );
            heroCharacter.AddAction(Action.E_Type.GetConsumable,
                delegate(float value, GameInstance firer, string[] param)
                {
                    if (RandomTool.IsIn(value))
                    {
                        var itemCommand = itemDropManager.DropItem();
                        if (itemCommand != null)
                        {
                            heroCharacter.TryAddItem(itemCommand);
                        }
                    }
                    return null;
                }
            );
        }

        return heroCharacter;
    }