public async Task <PlayerAbility> AddPlayerAbility(PlayerAbility playerAbility)
        {
            var result = await _dbContext.PlayerAbilities.AddAsync(playerAbility);

            foreach (var value in playerAbility.BaseAbility.ModifiesBaseTrainingValues)
            {
                _dbContext.Entry(value).State = EntityState.Unchanged;
            }
            foreach (var skill in playerAbility.SupportsPlayerSkills)
            {
                _dbContext.Entry(skill).State           = EntityState.Unchanged;
                _dbContext.Entry(skill.BaseSkill).State = EntityState.Unchanged;
            }
            _dbContext.Entry(playerAbility.BaseAbility).State = EntityState.Unchanged;
            foreach (var attribute in playerAbility.BaseAbility.UsesBaseAttributes)
            {
                _dbContext.Entry(attribute).State = EntityState.Unchanged;
            }
            await _dbContext.SaveChangesAsync();

            return(result.Entity);
        }
示例#2
0
    public void AbilityHandler(PlayerAbility ability)
    {
        switch (ability.Type)
        {
        case PlayerAbility.AbilityType.EnemyTarget:
            mTargetAbility = ability;
            ARangeDisplay.transform.localScale = new Vector3(ability.Range * 2, 0, ability.Range * 2);
            ARangeDisplay.enabled = true;
            mETargetSelect        = true;
            AttackAble            = false;
            break;

        case PlayerAbility.AbilityType.AllyTarget:
            mTargetAbility = ability;
            ARangeDisplay.transform.localScale = new Vector3(ability.Range * 2, 0, ability.Range * 2);
            ARangeDisplay.enabled = true;
            mFTargetSelect        = true;
            AttackAble            = false;
            break;

        case PlayerAbility.AbilityType.Self:

            ability.UseAbility(this, PrimaryStat, SecondaryStat, mGameController);
            AttackAble = false;

            break;

        case PlayerAbility.AbilityType.WorldTarget:

            mWorldAbility = ability;
            ARangeDisplay.transform.localScale = new Vector3(ability.Range * 2, 0, ability.Range * 2);
            ARangeDisplay.enabled = true;
            mSelectLocation       = true;
            AttackAble            = false;

            break;
        }
    }
示例#3
0
        public async Task <PlayerAbility> UpdatePlayerAbility(PlayerAbility playerAbility)
        {
            var result = await _dbContext.PlayerAbilities
                         .FirstOrDefaultAsync(a => a.Id == playerAbility.Id);

            if (result != null)
            {
                result.BaseAbility                 = playerAbility.BaseAbility;
                result.Notes                       = playerAbility.Notes;
                result.Tier                        = playerAbility.Tier;
                result.SupportsPlayerSkills        = playerAbility.SupportsPlayerSkills;
                result.Type                        = playerAbility.Type;
                result.AddedUsingBaseAttributeCode = playerAbility.AddedUsingBaseAttributeCode;


                foreach (var skill in playerAbility.SupportsPlayerSkills)
                {
                    _dbContext.Entry(skill.BaseSkill).State = EntityState.Unchanged;
                }
                foreach (var attribute in playerAbility.BaseAbility.UsesBaseAttributes)
                {
                    _dbContext.Entry(attribute).State = EntityState.Unchanged;
                }
                foreach (var value in playerAbility.BaseAbility.ModifiesBaseTrainingValues)
                {
                    _dbContext.Entry(value).State = EntityState.Unchanged;
                }
                _dbContext.Entry(playerAbility.BaseAbility).State = EntityState.Unchanged;
                _dbContext.PlayerAbilities.Update(result);
                await _dbContext.SaveChangesAsync();

                return(result);
            }

            return(null);
        }
示例#4
0
 public override string GetAbilityTooltip(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) =>
 "Allows manipulation of fire elements. Each Exort instance provides increased attack damage to magic weapons.\n" +
 $"Damage per instance: {AbilitiesHelper.GenerateCleanSlashedString(GetExtraDamage, dotariaPlayer, this)}";
示例#5
0
        public static void SpecialAbility(PlayerAbility ability)
        {
            if (ability != PlayerAbility.NULL)
            {
                if (Player.Gold >= specialAbilityCost)
                {
                    Player.Gold -= specialAbilityCost;

                    switch (ability)
                    {
                        case PlayerAbility.PARALYZE: paralyze(); break;
                        case PlayerAbility.KILL: kill(); break;
                        case PlayerAbility.SLOW: slow(); break;
                        case PlayerAbility.BOOST: boost(); break;
                    }
                }
                else
                {
                    Console.WriteLine("Error: Player cannot afford special ability");
                }
            }
        }
示例#6
0
        public async Task <ActionResult <PlayerAbility> > UpdatePlayerAbility(int id, PlayerAbility playerAbility)
        {
            try
            {
                if (id != playerAbility.Id)
                {
                    return(BadRequest($"Ability ID mismatch. Specified ID = {id} | Ability ID = {playerAbility.Id}"));
                }

                var playerAbilityToUpdate = await _playerAbilityRepository.GetPlayerAbility(id);

                if (playerAbilityToUpdate == null)
                {
                    return(NotFound($"Could not find Ability with ID = {id}."));
                }

                return(await _playerAbilityRepository.UpdatePlayerAbility(playerAbility));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Error updating data in the database."));
            }
        }
 private void abilityActivated(PlayerAbility ability, bool active)
 {
     //Update effects
     updateEffect();
 }
示例#8
0
 private void Start()
 {
     m_PlayerAnimator   = Player.m_Instance.GetComponentInChildren <Animator>();
     m_AbilityBehaviour = m_PlayerAnimator.GetBehaviour <PlayerAbility>();
 }
 public void abilityActivated(PlayerAbility ability, bool active)
 {
     onAbilityActivated?.Invoke(ability, active);
 }
 public void ActivateGrid(PlayerAbility ability)
 {
     isActive   = true;
     curAbility = ability;
     Shader.SetGlobalFloat("playerTakingWalkInput", 0);
 }
 public override float GetCooldown(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => dotariaPlayer.HasAghanims() ? 2 : 6;
示例#12
0
    private void SetAbility(string nameAbility)
    {
        PlayerAbility playerAbility = null;

        try
        {
            if (!nameAbility.Contains("Burst"))
            {
                if (nameAbility == simplePlayerPanelDataSet.NameButtons[0] && !isStartCoolDown[0])
                {
                    playerAbility      = new Damage(abilityDataSet[0], heroesInAttacked.abilityDataSet[0], idTurn, heroesInAttacked.idTurn);
                    isStartCoolDown[0] = true;
                    coolDown[0]        = 0;
                    if (idTurn == heroesInAttacked.idTurn)
                    {
                        playerAbility      = null;
                        heroesInAttacked   = null;
                        isStartCoolDown[0] = false;
                    }
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[1] && !isStartCoolDown[1])
                {
                    playerAbility      = new Shield(abilityDataSet[1]);
                    heroesInAttacked   = null;
                    isStartCoolDown[1] = true;
                    coolDown[1]        = 0;
                }
                this.playerAbility = playerAbility;
            }
            else
            {
                if (nameAbility == simplePlayerPanelDataSet.NameButtons[2] && !isStartCoolDown[2])
                {
                    if (abilityDataSet[2].CurrentLevel < abilityDataSet[2].CountLevelLimit)
                    {
                        playerAbility      = new BurstEnergy(abilityDataSet[2]);
                        isStartCoolDown[2] = true;
                        if (IsMain && abilityDataSet[2].CurrentLevel >= abilityDataSet[2].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[2].SetActive(false);
                        }
                    }
                    coolDown[2] = 0;
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[3])
                {
                    if (abilityDataSet[0].CurrentLevel < abilityDataSet[0].CountLevelLimit)
                    {
                        playerAbility = new Damage(abilityDataSet[0], idTurn);
                        if (IsMain && abilityDataSet[0].CurrentLevel >= abilityDataSet[0].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[3].SetActive(false);
                        }
                    }
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[4])
                {
                    if (abilityDataSet[1].CurrentLevel < abilityDataSet[1].CountLevelLimit)
                    {
                        playerAbility = new Shield(abilityDataSet[1]);
                        if (IsMain && abilityDataSet[1].CurrentLevel >= abilityDataSet[1].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[4].SetActive(false);
                        }
                    }
                }
                heroesInAttacked     = null;
                this.playerUpAbility = playerAbility;
            }
        }
        catch (System.NullReferenceException)
        {
            Debug.Log("Выбери цель с начала, а потом жми (Речь про дамажущую кнопочку)");
        }
        if (playerAbility != null)
        {
            SetCanMove(true);
            CountReadyHero++;
            onReadyHero?.Invoke();
        }
    }
示例#13
0
 public override float GetManaCost(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => (-100f * playerAbility.Level + 500) / (playerAbility.Level + 1);
示例#14
0
 public override float GetCooldown(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => 160 - playerAbility.Level * 40;
 public void ShowAddGlyphUI(PlayerAbility ability, Glyph glyphToAdd)
 {
     AddGlyphUI.Show(ability, glyphToAdd);
 }
示例#16
0
 public static float GetExtraHealthRegeneration(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => playerAbility.Level;
示例#17
0
 public override void CastElementPlayerResetEffects(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) =>
 dotariaPlayer.player.lifeRegen += (int)GetExtraHealthRegeneration(dotariaPlayer, playerAbility);
 public override string GetAbilityTooltip(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) =>
 "Combines the properties of the elements currently being manipulated to create a new spell for Invoker to use. Will cast the spell combination if the player has enough mana and if the spell is on cooldown.\n\nMax spells: 2";
示例#19
0
 public override void CastElementModifyWeaponDamage(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility, Item item, ref float add, ref float mult, ref float flat)
 {
     if (item.magic)
     {
         flat += GetExtraDamage(dotariaPlayer, playerAbility);
     }
 }
 public override float GetManaCost(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => 0;
示例#21
0
 public static float GetExtraDamage(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => 2 * playerAbility.Level;
示例#22
0
 // Start is called before the first frame update
 void Start()
 {
     con = GetComponent <PlayerController>();
     abi = GetComponent <PlayerAbility>();
 }
示例#23
0
 public override float GetCooldown(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) => 0;
 public void abilityUpgraded(PlayerAbility ability, int upgradeLevel)
 {
     onAbilityUpgraded?.Invoke(ability, upgradeLevel);
 }
示例#25
0
 void AbilityPicked(PlayerAbility ability)
 {
     activeAbility = ability;
     activeAbility.SetAbilityModifiers(abilityModifiers);
     ability.SelectTargets(TargettingFinished);
 }
示例#26
0
    public void Init(out GetQuset getQuset, MakeBoss makeBoss, PlayerAbility playerAbility)
    {
        DamageObj = Resources.Load("UI/Box/DamegeTxt") as GameObject;
        NameObj   = Resources.Load("UI/Box/NameTxt") as GameObject;
        HpObj     = Resources.Load("UI/Box/HpImg") as GameObject;

        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Buy_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Quest_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Portion_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Boss_NPC") as GameObject);
        m_LisLoadNPC.Add(Resources.Load("UI/NPC/Clear_NPC") as GameObject);

        //데미지 부분 미리 10개 생성
        for (int i = 0; i < 10; ++i)
        {
            GameObject damageObj = Instantiate(DamageObj);

            DamageTxt damageTxt = damageObj.GetComponent <DamageTxt>();
            damageObj.transform.SetParent(DamageBox);

            m_LisDamageTxt.Add(damageObj);
            m_DicDamageTxt.Add(m_LisDamageTxt[i], damageTxt);

            damageTxt.Init();
            damageObj.SetActive(false);
        }

        for (int i = 0; i < 5; ++i)
        {
            GameObject hpObj = Instantiate(HpObj, HpBox.transform);
            Image      hpimg = hpObj.GetComponent <Image>();
            m_LisHpImg.Add(hpObj);
            m_DicHpImg.Add(i, hpimg);
            hpObj.SetActive(false);

            GameObject nameObj = Instantiate(NameObj, NameBox.transform);
            Text       nameTxt = nameObj.GetComponent <Text>();
            m_LisNameTxt.Add(nameObj);
            m_DicNameTxt.Add(i, nameTxt);
            nameObj.SetActive(false);

            ++m_nAddCount;
        }

        m_DicIndexObj.Add(m_BuyMenu.gameObject, 0);
        m_DicIndexObj.Add(m_QuestMenu.gameObject, 1);
        m_DicIndexObj.Add(m_PortionMenu.gameObject, 2);
        m_DicIndexObj.Add(m_BossClearAsk.gameObject, 3);

        m_DicIndex.Add(0, m_BuyMenu.gameObject);
        m_DicIndex.Add(1, m_QuestMenu.gameObject);
        m_DicIndex.Add(2, m_PortionMenu.gameObject);
        m_DicIndex.Add(3, m_GateAsk.gameObject);
        m_DicIndex.Add(4, m_BossClearAsk.gameObject);

        Object[] weaponbtnObj = null;
        Object[] defenseObj   = Resources.LoadAll("UI/EquipmentBtn/Armor");
        Object[] portionObj   = Resources.LoadAll("UI/EquipmentBtn/Portion");

        switch (playerAbility.m_nIndex)
        {
        case 1:
            weaponbtnObj = Resources.LoadAll("UI/EquipmentBtn/Weapon/TowHandSword");
            break;

        case 2:
            weaponbtnObj = Resources.LoadAll("UI/EquipmentBtn/Weapon/Magician");
            break;
        }

        for (int i = 0; i < weaponbtnObj.Length; ++i)
        {
            m_LisWeaponBtnObj.Add(weaponbtnObj[i] as GameObject);
        }
        for (int i = 0; i < defenseObj.Length; ++i)
        {
            m_LisDefenseBtnObj.Add(defenseObj[i] as GameObject);
        }
        for (int i = 0; i < portionObj.Length; ++i)
        {
            m_LisPortionBtnObj.Add(portionObj[i] as GameObject);
        }
        m_BuyMenu.Init(m_LisWeaponBtnObj, m_LisDefenseBtnObj, playerAbility);
        m_QuestMenu.Init(out getQuset);
        m_PortionMenu.Init(m_LisPortionBtnObj);

        PlayerPos _playerPos = m_BossClearAsk.Init();

        m_GateAsk.Init(makeBoss, _playerPos, QuestBox.gameObject);
    }
示例#27
0
    void Update()
    {
        MonitorShakeScreen();
        MonitorPlayerCount();
        MonitorDropPlayer();

        if (rWPlayer1.GetButtonDown("AButton") && !player1Active)
        {
            playerCount++;
            numHolder.numConnectedPlayers++;

            player1Active = true;
            p1Text.SetActive(false);
            p1Portal.enabled = true;

            player1Copy = Instantiate(player1, player1StartPos, Quaternion.identity) as GameObject;
            //Ref
            player1MoveScript    = player1Copy.GetComponent <PlayerMovement>();
            player1ShootScript   = player1Copy.GetComponent <PlayerShoot>();
            player1AbilityScript = player1Copy.GetComponent <PlayerAbility>();
            player1HealthScript  = player1Copy.GetComponent <PlayerHealth>();
            player1SpriteManager = player1Copy.GetComponent <SpriteManager>();

            //Set Component References
            player1TeamCount = 0;
            player1MoveScript.classSelect          = true;
            player1HealthScript.titleScreenManager = this;//Set up
            player1HealthScript.titleScreen        = true;
            player1HealthScript.PickUp(100);
            player1SpriteManager.numPlayer = 1;
            player1SpriteManager.ShowPlayer();

            SetTeamCount(player1SpriteManager, player1TeamCount);
            SetOffensiveSystem(RandomNum(false), 1);
            SetDefensiveSystem(RandomNum(true), 1);

            StartCoroutine(Player1UI());
        }

        if (rWPlayer2.GetButtonDown("AButton") && !player2Active)
        {
            playerCount++;
            numHolder.numConnectedPlayers++;

            player2Active = true;
            p2Text.SetActive(false);
            p2Portal.enabled = true;

            //Player2
            player2Copy                            = Instantiate(player2, player2StartPos, Quaternion.identity) as GameObject;
            player2MoveScript                      = player2Copy.GetComponent <PlayerMovement>();
            player2TeamCount                       = 1;
            player2ShootScript                     = player2Copy.GetComponent <PlayerShoot>();
            player2MoveScript.classSelect          = true;
            player2AbilityScript                   = player2Copy.GetComponent <PlayerAbility>();
            player2HealthScript                    = player2Copy.GetComponent <PlayerHealth>();
            player2HealthScript.titleScreenManager = this;
            player2HealthScript.titleScreen        = true;
            player2HealthScript.PickUp(100);


            player2SpriteManager           = player2Copy.GetComponent <SpriteManager>();
            player2SpriteManager.numPlayer = 2;
            player2SpriteManager.ShowPlayer();


            SetTeamCount(player2SpriteManager, player2TeamCount);
            SetOffensiveSystem(RandomNum(false), 2);
            SetDefensiveSystem(RandomNum(true), 2);

            StartCoroutine(Player2UI());
        }

        if (rWPlayer3.GetButtonDown("AButton") && !player3Active)
        {
            playerCount++;
            numHolder.numConnectedPlayers++;

            player3Active = true;
            p3Text.SetActive(false);
            p3Portal.enabled = true;

            player3Copy                   = Instantiate(player3, player3StartPos, Quaternion.identity) as GameObject;
            player3MoveScript             = player3Copy.GetComponent <PlayerMovement>();
            player3TeamCount              = 2;
            player3ShootScript            = player3Copy.GetComponent <PlayerShoot>();
            player3MoveScript.classSelect = true;
            player3AbilityScript          = player3Copy.GetComponent <PlayerAbility>();

            player3HealthScript = player3Copy.GetComponent <PlayerHealth>();
            player3HealthScript.titleScreenManager = this;
            player3HealthScript.titleScreen        = true;
            player3HealthScript.PickUp(100);


            player3SpriteManager           = player3Copy.GetComponent <SpriteManager>();
            player3SpriteManager.numPlayer = 3;
            player3SpriteManager.ShowPlayer();


            SetTeamCount(player3SpriteManager, 2);
            SetOffensiveSystem(RandomNum(false), 3);
            SetDefensiveSystem(RandomNum(true), 3);

            StartCoroutine(Player3UI());
        }

        if (rWPlayer4.GetButtonDown("AButton") && !player4Active)
        {
            playerCount++;
            numHolder.numConnectedPlayers++;

            player4Active = true;
            p4Text.SetActive(false);
            p4Portal.enabled = true;

            player4Copy                            = Instantiate(player4, player4StartPos, Quaternion.identity) as GameObject;
            player4MoveScript                      = player4Copy.GetComponent <PlayerMovement>();
            player4TeamCount                       = 3;
            player4ShootScript                     = player4Copy.GetComponent <PlayerShoot>();
            player4MoveScript.classSelect          = true;
            player4AbilityScript                   = player4Copy.GetComponent <PlayerAbility>();
            player4HealthScript                    = player4Copy.GetComponent <PlayerHealth>();
            player4HealthScript.titleScreenManager = this;
            player4HealthScript.titleScreen        = true;
            player4HealthScript.PickUp(100);

            player4SpriteManager           = player4Copy.GetComponent <SpriteManager>();
            player4SpriteManager.numPlayer = 4;
            player4SpriteManager.ShowPlayer();


            SetTeamCount(player4SpriteManager, 3);
            SetOffensiveSystem(RandomNum(false), 4);
            SetDefensiveSystem(RandomNum(true), 4);

            StartCoroutine(Player4UI());
        }
    }
    public void CalculatePitcherColliderInterraction(GameObject ballGameObject, BallController ballControllerScript, GenericPlayerBehaviour genericPlayerBehaviourScript)
    {
        int runnersOnFieldCount   = -1;
        List <GameObject> runners = PlayerUtils.GetRunnersOnField();

        runnersOnFieldCount = runners.Count;

        if (runnersOnFieldCount < 1)
        {
            return;
        }

        //Choose the runner who just hit the ball
        GameObject runnerToGetOut = runners.Last();

        bool hasIntercepted = false;
        PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();

        if (ballControllerScript.BallHeight == BallHeightEnum.HIGH || ballControllerScript.BallHeight == BallHeightEnum.LOW)
        {
            GameManager      gameManager            = GameUtils.FetchGameManager();
            DialogBoxManager dialogBoxManagerScript = GameUtils.FetchDialogBoxManager();
            dialogBoxManagerScript.DisplayDialogAndTextForGivenAmountOfTime(1f, false, "TAG OUT !!!!!!!");

            ballControllerScript.Target = null;


            PlayerActionsManager.InterceptBall(ballGameObject, ballControllerScript, genericPlayerBehaviourScript);
            hasIntercepted = true;

            gameManager.AttackTeamRunnerList.Remove(runnerToGetOut);
            runnerToGetOut.SetActive(false);
            playersTurnManager.UpdatePlayerTurnQueue(runnerToGetOut);
            gameManager.AttackTeamBatterListClone.First().SetActive(true);
            RunnerBehaviour runnerBehaviourScript = PlayerUtils.FetchRunnerBehaviourScript(runnerToGetOut);
            BatterBehaviour batterBehaviourScript = PlayerUtils.FetchBatterBehaviourScript(gameManager.AttackTeamBatterListClone.First());
            batterBehaviourScript.EquipedBat = runnerBehaviourScript.EquipedBat;
            runnerBehaviourScript.EquipedBat = null;

            if (runnersOnFieldCount == 1)
            {
                GameData.isPaused = true;
                StartCoroutine(gameManager.WaitAndReinit(dialogBoxManagerScript, PlayerUtils.FetchPlayerStatusScript(gameManager.AttackTeamBatterListClone.First()), FieldBall));
                return;
            }
            else
            {
                GameObject bat = batterBehaviourScript.EquipedBat;
                bat.transform.SetParent(null);
                bat.transform.position = FieldUtils.GetBatCorrectPosition(batterBehaviourScript.transform.position);
                bat.transform.rotation = Quaternion.Euler(0f, 0f, -70f);
                bat.transform.SetParent(gameManager.AttackTeamBatterListClone.First().transform);
                batterBehaviourScript.EquipedBat.SetActive(true);
                TeamUtils.AddPlayerTeamMember(PlayerFieldPositionEnum.BATTER, batterBehaviourScript.gameObject, TeamUtils.GetBaseballPlayerOwner(batterBehaviourScript.gameObject));
            }
        }

        if (runnersOnFieldCount >= 1)
        {
            if (!hasIntercepted)
            {
                PlayerActionsManager.InterceptBall(ballGameObject, ballControllerScript, genericPlayerBehaviourScript);
            }

            PlayerActionsManager playerActionsManager = GameUtils.FetchPlayerActionsManager();
            PlayerAbilities      playerAbilities      = PlayerUtils.FetchPlayerAbilitiesScript(this.gameObject);
            playerAbilities.ReinitAbilities();
            PlayerAbility passPlayerAbility = new PlayerAbility("Pass to fielder", AbilityTypeEnum.BASIC, AbilityCategoryEnum.NORMAL, playerActionsManager.GenericPassAction, this.gameObject, true);
            playerAbilities.AddAbility(passPlayerAbility);
            playersTurnManager.TurnState      = TurnStateEnum.PITCHER_TURN;
            PlayersTurnManager.IsCommandPhase = true;
        }
    }
示例#29
0
 public override string GetAbilityTooltip(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) =>
 "Shadow Fiend razes the ground directly in front of him, dealing damage to enemy units in the area. Adds a stacking damage amplifier on the target that causes the enemy to take bonus Shadow Raze damage per stack.\n\n" + base.GetAbilityTooltip(dotariaPlayer, playerAbility);
示例#30
0
        public async Task <ActionResult <PlayerAbility> > DeletePlayerAbility(int id, PlayerAbility playerAbility)
        {
            try
            {
                var playerAbilityToDelete = await _playerAbilityRepository.GetPlayerAbility(id);

                if (playerAbilityToDelete == null)
                {
                    return(BadRequest($"Could not find Ability with ID = {id}."));
                }

                return(await _playerAbilityRepository.DeletePlayerAbility(id));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Error deleting data from the database."));
            }
        }
示例#31
0
    public virtual void Update()
    {
        if (Health <= 0)
        {
            Death();
        }

        if (ActionPoints > MaxActionPoints)
        {
            ActionPoints = MaxActionPoints;
        }

        if (EndingTurn)
        {
            if (FinishedMoving)
            {
                EndTurn();
            }
        }

        if (TurnActive || TurnPaused)
        {
            if (!mSelectLocation && !mFTargetSelect && !mETargetSelect && !MoveAble && !AttackAble && !mMoving && FinishedMoving)
            {
                EndTurn();
            }
        }

        if (TurnActive)
        {
            if (Health > MaxHealth)
            {
                Health = MaxHealth;
            }

            if (Input.GetMouseButtonDown(0) && GUIUtility.hotControl == 0 && TurnActive)
            {
                var        playerPlane = new Plane(Vector3.up, transform.position);
                Ray        ray         = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                float      hitdist = 0.0f;

                if (mETargetSelect)
                {
                    if (Physics.Raycast(ray, out hit))
                    {
                        if (hit.collider.gameObject.tag == "Enemy" && Vector3.Distance(hit.transform.position, transform.position) <= mTargetAbility.Range)
                        {
                            mEnemyTarget = hit.collider.gameObject.GetComponent <Enemy> ();
                            print("enemy target aquired!");
                            mTargetAbility.UseAbility(this, mEnemyTarget, PrimaryStat, SecondaryStat);
                            ARangeDisplay.enabled = false;
                            mETargetSelect        = false;
                            mTargetAbility        = null;
                        }
                    }
                }
                else if (mFTargetSelect)
                {
                    if (Physics.Raycast(ray, out hit))
                    {
                        if (hit.collider.gameObject.tag == "Player" && Vector3.Distance(hit.transform.position, transform.position) <= mTargetAbility.Range)
                        {
                            mFriendlyTarget = hit.collider.gameObject.GetComponent <Player> ();
                            print("friendly target aquired!");
                            mTargetAbility.UseAbility(this, mFriendlyTarget, PrimaryStat, SecondaryStat);
                            ARangeDisplay.enabled = false;
                            mFTargetSelect        = false;
                            mTargetAbility        = null;
                        }
                    }
                }
                else if (MovePhase)
                {
                    if (Physics.Raycast(ray, out hit))
                    {
                        if (hit.collider.tag == "Ground")
                        {
                            if (playerPlane.Raycast(ray, out hitdist))
                            {
                                Vector3 targetPoint = ray.GetPoint(hitdist);
                                TargetNode = mAstarPath.astarData.gridGraph.GetNearest(targetPoint).node;
                                if (TargetNode != null)
                                {
                                    GraphNode match = MoveableNodes.FirstOrDefault(x => x.position == TargetNode.position);
                                    if (match != null)
                                    {
                                        MoveCharacter(targetPoint);
                                        ClearRender();
                                        MoveAble = false;
                                        SelectionIndicator.SetActive(true);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (mSelectLocation)
                {
                    if (Physics.Raycast(ray, out hit))
                    {
                        if (hit.collider.tag == "Ground")
                        {
                            if (playerPlane.Raycast(ray, out hitdist))
                            {
                                Vector3 targetPoint = ray.GetPoint(hitdist);

                                if (Vector3.Distance(transform.position, targetPoint) <= mWorldAbility.Range)
                                {
                                    mWorldAbility.UseAbility(this, targetPoint, PrimaryStat, SecondaryStat, mGameController);
                                    ARangeDisplay.enabled = false;
                                    mWorldAbility         = null;
                                    mSelectLocation       = false;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (Physics.Raycast(ray, out hit))
                    {
                        if (hit.collider.gameObject.tag == "Item" && Vector3.Distance(hit.transform.position, transform.position) <= 8)
                        {
                            ItemPickup hitItem = hit.collider.gameObject.GetComponent <ItemPickup>();
                            Inventory.AddItem(hitItem.ItemID, hitItem.ItemQuantity);
                            hitItem.RemoveObject();
                        }
                        else if (hit.collider.gameObject.tag == "Interactable" && Vector3.Distance(hit.transform.position, transform.position) <= 8)
                        {
                            Debug.Log("Using Object!");
                            hit.collider.gameObject.GetComponent <InteractiveObject>().UseObject();
                        }
                        else if (hit.collider.gameObject.tag == "Player")
                        {
                            Player SelectedPlayer = hit.collider.gameObject.GetComponent <Player>();

                            if (mGameController.PlayerInActiveList(SelectedPlayer))
                            {
                                PauseTurn();
                                if (SelectedPlayer.TurnPaused)
                                {
                                    SelectedPlayer.ResumeTurn();
                                }
                                else
                                {
                                    SelectedPlayer.StartTurn();
                                }
                            }
                        }
                    }
                }
            }



            if (Input.GetMouseButtonDown(1) && TurnActive)
            {
                if (mSelectLocation || mETargetSelect || mFTargetSelect)
                {
                    mSelectLocation       = false;
                    mETargetSelect        = false;
                    mFTargetSelect        = false;
                    mWorldAbility         = null;
                    mTargetAbility        = null;
                    ARangeDisplay.enabled = false;
                    AttackAble            = true;
                }

                if (MovePhase && MoveAble)
                {
                    MovePhase = false;
                    SelectionIndicator.SetActive(true);
                    ClearRender();
                }
            }
        }
        else
        {
            ARangeDisplay.enabled = false;
        }
    }