Beispiel #1
0
        public bool IsTargetAlreadyAffected(Entity target, Status status, SpecialAbility sourceAbility)
        {
            if (this.target != target)
            {
                return(false);
            }

            List <Status> existingStatus = statusContainer.GetStatusListByType(status.statusType);
            int           count          = existingStatus.Count;

            if (count < 1)
            {
                return(false);
            }

            for (int i = 0; i < count; i++)
            {
                if (existingStatus[i].IsFromSameSource(sourceAbility))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
    public virtual void Initialize(Entity source, SpecialAbilityData abilitydata, List <SpecialAbilityData> sequencedAbilities = null)
    {
        this.source      = source;
        this.abilitydata = abilitydata;
        SessionID        = IDFactory.GenerateAbilityID();
        SetUpAbility();

        if (sequencedAbilities != null && sequencedAbilities.Count > 0)
        {
            for (int i = 0; i < sequencedAbilities.Count; i++)
            {
                SpecialAbility sAbility = new SpecialAbility();
                this.sequencedAbilities.Add(sAbility);
                sAbility.ParentAbility = this;
                sAbility.Initialize(source, sequencedAbilities[i]);
                //Debug.Log(sequencedAbilities[i].abilityName + " is a sequence of " + abilitydata.abilityName);
            }

            sequenceTimer = new Timer(sequenceWindow, false, ResetSequenceIndex);
        }

        animationHash = Animator.StringToHash(animationTrigger);

        if (activationMethod == Constants.SpecialAbilityActivationMethod.Passive)
        {
            Activate();
        }
    }
Beispiel #3
0
        public void EgoSumsAllFactors()
        {
            var communication = new[] { "Read", "Read magic", "Telepathy" };

            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceStrongStats)).Returns("19");
            mockAttributesSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.IntelligenceCommunication, "19")).Returns(communication);
            intelligenceAttributesResult.LesserPowersCount  = 2;
            intelligenceAttributesResult.GreaterPowersCount = 2;

            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.IntelligencePOWERPowers, "Greater");

            mockPercentileSelector.SetupSequence(s => s.SelectFrom(tableName)).Returns("greater power 1").Returns("greater power 2");
            mockDice.Setup(d => d.Roll(1).d(4).AsSum()).Returns(1);
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceSpecialPurposes)).Returns("purpose");
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceDedicatedPowers)).Returns("dedicated power");

            tableName = string.Format(TableNameConstants.Percentiles.Formattable.IntelligencePOWERPowers, "Lesser");
            mockPercentileSelector.SetupSequence(s => s.SelectFrom(tableName)).Returns("power 1").Returns("power 2");

            var ability = new SpecialAbility();

            ability.BonusEquivalent     = 92;
            item.Magic.SpecialAbilities = new[] { ability };
            item.Magic.Bonus            = 66;

            var intelligence = intelligenceGenerator.GenerateFor(item);

            Assert.That(intelligence.Ego, Is.EqualTo(177));
        }
Beispiel #4
0
        public static void ApplySpecialAbility(Hero hero, SpecialAbility ability, DnDContext context)
        {
            if (ability.AblityType == SpecialAbilityType.Attack)
            {
                hero.SpecialAbilities.Add(ability);
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.White;
                hero.AttackPower       += ability.Power;
                hero.SpecialAbilities.Add(ability);

                context.SaveChanges();
                Utility.PhaseTyper($"Your Attack power increased by {ability.Power}");
                Utility.PhaseTyper($"Total Attack Power: {hero.AttackPower}");
                Console.WriteLine();
                Utility.PhaseTyper("Press any key to continue...");
                Console.ReadKey();
            }
            else if (ability.AblityType == SpecialAbilityType.Deffence)
            {
                hero.SpecialAbilities.Add(ability);
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.White;
                hero.DeffencePower     += ability.Power;
                hero.SpecialAbilities.Add(ability);

                context.SaveChanges();
                Utility.PhaseTyper($"Your Deffence power increased by {ability.Power}");
                Utility.PhaseTyper($"Total Defece Power: {hero.DeffencePower}");
                Console.WriteLine();
                Utility.PhaseTyper("Press any key to continue...");
                Console.ReadKey();
            }
        }
Beispiel #5
0
    private void DisplayCharacter(int characterIndex)
    {
        //refresh character list
        characters = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <CharacterManager>().GetCharacters();
        GameObject         character          = characters[characterIndex];
        CharacterSpecifics characterSpecifics = character.GetComponent <CharacterSpecifics>();
        SpecialAbility     specialAbility     = character.GetComponent <SpecialAbility>();

        if (characterSpecifics.isUnlocked)
        {
            characterImage.sprite     = character.GetComponent <Image>().sprite;
            characterName.text        = characterSpecifics.characterName;
            characterDescription.text = characterSpecifics.description.Replace("\\n", "\n");

            specialImage.sprite     = specialAbility.specialIcon;
            specialName.text        = specialAbility.specialName;
            specialDescription.text = specialAbility.specialDescription.Replace("\\n", "\n");

            maxHealth.text   = characterSpecifics.maxHealth.ToString();
            maxSpecial.text  = characterSpecifics.maxSpecial.ToString();
            specialRate.text = characterSpecifics.specialAbilityLoadingRate.ToString() + "/s";
        }
        else
        {
            DisplayDefault();
            DisplayCharacterPreview(characters[characterIndex]);
        }

        currentDisplayIndex = characterIndex;
    }
    //called when player is actually using the cyclone ability
    //spins player around and hits all enemies around them
    //player heals for every 3 enemies they hit
    private void UsingCyclone()
    {
        _currComboTime = (Time.time - _startComboTime) / _cycloneDuration;


        if (_currComboTime < 1)
        {
            if (_debugCyclone)
            {
                Debug.DrawLine(transform.position, transform.position + (transform.forward * _cycloneDetectionDistance));
            }

            if (Physics.Raycast(_sword.transform.position, _sword.transform.up, out hit, _cycloneDetectionDistance))
            {
                if (hit.collider.GetComponent <AIEnemy>())
                {
                    AIEnemy EnemyHit = hit.collider.GetComponent <AIEnemy>();

                    //Debug.Log("hit");

                    if (_enemyHit.Count > 0)
                    {
                        if (!CycloneAlreadyHitEnemy(EnemyHit))
                        {
                            if (EnemyHit.GotHit(_cycloneAttackDamage, transform.forward * _cycloneKnockBack, hit.point))
                            {
                                Debug.Log("cyclone hit");
                                _enemyHit.Add(EnemyHit);
                                ContinueCombo();
                                if (_enemyHit.Count > 2)
                                {
                                    _enemyHit = new List <AIEnemy>();
                                    Debug.Log("cyclone heal");
                                    _pStats.PHeal(_cycloneHeal);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (EnemyHit.GotHit(_cycloneAttackDamage, transform.forward * _cycloneKnockBack, hit.point))
                        {
                            Debug.Log("cyclone hit");
                            ContinueCombo();
                            _enemyHit.Add(EnemyHit);
                        }
                    }
                }
            }
            transform.Rotate(Vector3.up, _cycloneSpinSpeed);
        }
        else
        {
            _currComboTime = 1;

            _myability = SpecialAbility.NONE;
            _sword.transform.localPosition = _swordReset;
            _enemyHit = new List <AIEnemy>();
        }
    }
    public void SelectSpecialAttack()
    {
        switch (selectedButton)
        {
        case SelectedButton.North:
            SpecialAbility abilityNorth = Instantiate(specialAbilityNorth);
            abilityNorth.CreateAbility(Agent, Agent, Agent.GetComponent <Animator>());
            return;

        case SelectedButton.South:
            SpecialAbility abilitySouth = Instantiate(specialAbilitySouth);
            abilitySouth.CreateAbility(Agent, Agent, Agent.GetComponent <Animator>());
            return;

        case SelectedButton.East:
            SpecialAbility abilityEast = Instantiate(specialAbilityEast);
            abilityEast.CreateAbility(Agent, Agent, Agent.GetComponent <Animator>());
            return;

        case SelectedButton.West:
            SpecialAbility abilityWest = Instantiate(specialAbilityWest);
            abilityWest.CreateAbility(Agent, Agent, Agent.GetComponent <Animator>());
            return;

        default:
            return;
        }
    }
Beispiel #8
0
 public static void SetPlayerSlot(SpecialAbility ability, int index)
 {
     if (mainHud != null)
     {
         mainHud.quickBar.SetQuickBarSlot(ability, index);
     }
 }
Beispiel #9
0
    public virtual void Initialize(Entity source, SpecialAbilityData abilitydata, List <SpecialAbilityData> sequencedAbilities = null)
    {
        this.source      = source;
        this.abilitydata = abilitydata;

        SetUpAbility();

        if (sequencedAbilities != null && sequencedAbilities.Count > 0)
        {
            for (int i = 0; i < sequencedAbilities.Count; i++)
            {
                SpecialAbility sAbility = new SpecialAbility();
                this.sequencedAbilities.Add(sAbility);
                sAbility.ParentAbility = this;
                sAbility.Initialize(source, sequencedAbilities[i]);
            }

            sequenceTimer = new Timer("SequenceTimer", sequenceWindow, false, ResetSequenceIndex);
        }

        if (activationMethod == Constants.SpecialAbilityActivationMethod.Passive)
        {
            Activate();
        }
    }
Beispiel #10
0
    void Update()
    {
        var tempHound = GameObject.Find("Enemy (Hound)");

        if (tempHound != null)
        {
            _hound = tempHound.GetComponent <Enemy>();
        }

        if (GameManager.Instance.GameData.CloseCalls < _closeCallsRequired)
        {
            _buttonImage.canvasRenderer.SetAlpha(UnusableAlpha);
        }

        if (GameManager.Instance.GameData.CloseCalls >= _closeCallsRequired)
        {
            _buttonImage.canvasRenderer.SetAlpha(1f);
            SpecialAbility toUseAbility = GetAbility();
            if (toUseAbility == SpecialAbility.Nothing)
            {
                return;
            }
            if (toUseAbility == ChosenAbility)
            {
                PerformAbility(toUseAbility);
            }
        }
    }
        void HandleAddTouchUpInside(object sender, EventArgs e)
        {
            SpecialAbility ab = new SpecialAbility();

            ab.Name = "Ability";
            ab.Type = "Ex";
            CurrentMonster.SpecialAbilitiesList.Add(ab);
        }
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateExit(animator, stateInfo, layerIndex);

        hitBoxDelivered = false;
        CurrentAbility  = null;
        //Debug.Log("Exiting " + stateName);
    }
Beispiel #13
0
    public virtual void Initialize(CardVisual source, SpecialAbility parent)
    {
        this.source   = source;
        parentAbility = parent;


        //Debug.Log(this + " is being initialized for " + parentAbility.source.cardData.cardName);
    }
Beispiel #14
0
        private SpecialAbility specialAbility; // the special ability of the monster

        /**
         * Constructor
         * @param id, the id of the monster
         * @param scaryLevel, the scare level of the monster
         * @param eye, type of the eye of the monster
         * @param hair, type of the hair of the monster
         * @param specialAbility, the special ability the monster possesses
         */
        public Monster(string id, int scaryLevel, Eye eye, Hair hair, SpecialAbility specialAbility)
        {
            this.id             = id;
            this.scaryLevel     = scaryLevel;
            this.eye            = eye;
            this.hair           = hair;
            this.specialAbility = specialAbility;
        }
    public void AddAbility(SpecialAbilityData abilityData, List <SpecialAbilityData> sequencedAbilities = null)
    {
        SpecialAbility newAbility = new SpecialAbility();

        newAbility.Initialize(source, abilityData, sequencedAbilities);


        abilities.AddUnique(newAbility);
    }
Beispiel #16
0
    // Update is called once per frame
    private void Update()
    {
        Movement.MoveHorizontalPlayerOne(rigidBody, transform);
        Movement.JumpPlayerOne(rigidBody);
        Movement.CheckBounds(transform);

        Damage.TakeDamagePlayerOne(playerOneHealthBar);
        SpecialAbility.IncreaseSpecialAbilityPlayerOne(playerOneSpecialAbilityBar);
    }
 public DefaultSword()
 {
     Id           = 0;
     Name         = "Samurai sword";
     Damage       = 20f;
     MainDistance = 0.74f;
     Sprite       = Resources.Load <Sprite>("Sprites\\Ammunition\\Swords\\DefaultSword");
     Ability      = new SpecialAbility(new[] { SpecialAbilityType.Nothing });
 }
Beispiel #18
0
    public void Initialize(PlayerQuickBar parent, SpecialAbility ability)
    {
        this.parent  = parent;
        this.ability = ability;

        recovery = ability.Recovery;

        SetIcon();
    }
 //resets everything about the player using any ability and makes the player to a basic state
 public void ResetAbilities()
 {
     _myability = SpecialAbility.NONE;
     _sword.transform.localPosition = _swordReset;
     if (_enemyIAmRamming != null)
     {
         _enemyHit        = new List <AIEnemy>();
         _enemyIAmRamming = null;
     }
 }
Beispiel #20
0
    public void SetQuickBarSlot(SpecialAbility ability, int slotIndex)
    {
        if (slotIndex > quickbarSlots.Count)
        {
            Debug.LogError("[PlayerQuickBar] index out of range. " + slotIndex + " is more than 4");
        }


        quickbarSlots[slotIndex].Initialize(this, ability);
    }
Beispiel #21
0
    public static void RegisterAbility(SpecialAbility ability)
    {
        //abiliites.Add(ability);

        AbilityHolder holder = new AbilityHolder(ability, ability.targets, ability.source.owner);

        savedAbilities.Add(holder);

        //Debug.Log(savedAbilities.Count + " is the list count");
    }
    public List <GameObject> EnablePlayers()
    {
        List <GameObject> playingPlayers = new List <GameObject>();

        for (int i = 0; i < playersControlles.Count; i++)
        {
            GameObject p1 = Instantiate(players[PlayersAvatar[i]].gameObject);
            p1.SetActive(true);
            p1.transform.position = playerPositions[i].position;

            ChickenController p1ChickenController = p1.GetComponent <ChickenController>();
            Healthbar         p1Healthbar         = p1.GetComponent <Healthbar>();
            ExtentedFeatures  p1ExtentedFeature   = p1.GetComponent <ExtentedFeatures>();
            SpecialAbility    p1SpecialAbility    = p1.GetComponent <SpecialAbility>();

            p1ChickenController.id = playersControlles[i];

            //Attach player Hud
            for (int j = 0; j < playersHUD.Length; j++)
            {
                Debug.Log(p1ChickenController.id + " - " + playersHUD[j].transform.GetChild(0).GetComponent <Text>().text);
                if (p1ChickenController.id == int.Parse(playersHUD[j].transform.GetChild(0).GetComponent <Text>().text))
                {
                    p1Healthbar.healthBar = playersHUD[j].transform.GetChild(2).GetComponent <Slider>();

                    p1ExtentedFeature.bashCoolDownSlider = playersHUD[j].transform.GetChild(4).GetComponent <Slider>();

                    p1SpecialAbility.abilityCoolDown = playersHUD[j].transform.GetChild(5).GetComponent <Slider>();

                    p1SpecialAbility.imageHolder = playersHUD[j].transform.GetChild(5).transform.GetChild(0).GetComponent <Image>();

                    break;
                }
            }

            playingPlayers.Add(p1);

            //players[PlayersAvatar[i]].GetComponent<ChickenController>().id = playersControlles[i];
            //playersFlag[PlayersAvatar[i]] = true;
        }

        //for (int i = 0; i < playersFlag.Length; i++)
        //{
        //    if (playersFlag[i])
        //    {
        //        playingPlayers.Add(players[i]);
        //    }
        //    else
        //    {
        //        Destroy(players[i]);
        //    }
        //}

        return(playingPlayers);
    }
Beispiel #23
0
        private string GetAbilitySummary(SpecialAbility ability)
        {
            var summary = ability.Name;

            if (ability.BonusEquivalent > 0)
            {
                summary += $"${ability.BonusEquivalent}$";
            }

            return(summary);
        }
Beispiel #24
0
        public SpecialAbility GetAbility()
        {
            SpecialAbility sa = new SpecialAbility
            {
                Name  = txtName.Text,
                Notes = txtNotes.Text,
                Type  = txtType.Text
            };

            return(sa);
        }
        public ActionResult GetSpecial(int id)
        {
            SpecialAbility special = ds.GetSpecialAbility(id);

            if (special == null)
            {
                return(NotFound());
            }

            return(Ok(special));
        }
Beispiel #26
0
 private void DecreaseAbilityCooldowns(IPokemon pokemon)
 {
     foreach (var ability in pokemon.Abilities)
     {
         SpecialAbility currentAbility = (SpecialAbility)ability;
         if (currentAbility.CurrentCooldown > 0)
         {
             currentAbility.CurrentCooldown -= 1;
         }
     }
 }
Beispiel #27
0
    private void PerformAbility(SpecialAbility ability)
    {
        GameManager.Instance.GameData.CloseCalls = 0;

        switch (ability)
        {
        case SpecialAbility.Claw:
            Claw();
            break;
        }
    }
Beispiel #28
0
 public void Update()
 {
     if (!SpecialAbility.IsTypePhysicsBased(specialAbility))
     {
         SpecialAbility.Perform(this);
     }
     else
     {
         performActionInFixedUpdate = true;
     }
 }
Beispiel #29
0
    public virtual void PopulateSpecialAblities(List <SpecialAbilityData> abilityData)
    {
        for (int i = 0; i < abilityData.Count; i++)
        {
            SpecialAbility newAbility = new SpecialAbility();

            newAbility.Initialize(source, abilityData[i], abilityData[i].sequencedAbilities);
            abilities.Add(newAbility);

            //Debug.Log("Adding " + newAbility.abilityName);
        }
    }
Beispiel #30
0
        public void GivenAnHtmlFormatter_WhenFormattingASpecialAbility_ThenFormatIsRespected()
        {
            var specialAbility = new SpecialAbility()
            {
                name = "Ability", desc = "Description"
            };
            var expected = $"<p class=\"RWDefault\"><span class=\"RWSnippet\"><b><i>{specialAbility.name}.</i></b> {specialAbility.desc}</span></p>";

            var actual = HtmlFormatter.Format(specialAbility);

            actual.Should().Be(expected);
        }
 public void addAbility(SpecialAbility ability)
 {
     activeAbilities.Add (ability);
 }
Beispiel #32
0
 public void SetSpell( int p1, int p2, int p3, int p4, int p5, int p6, float prob  )
 {
     spells[ nSpellAbility++ ] = new SpecialAbility( p1, p2, p3, p4, p5, p6, prob );
 }
        private IEnumerable<Item> GetTemplates(IEnumerable<string> setTreasure)
        {
            var templates = new List<Item>();

            foreach (var setItemTemplate in setTreasure)
            {
                var template = new Item();
                template.Name = setItemTemplate;
                template.Name = itemTypeRegex.Replace(template.Name, string.Empty);
                template.Name = itemBonusRegex.Replace(template.Name, string.Empty);
                template.Name = specialAbilityRegex.Replace(template.Name, string.Empty);
                template.Name = traitRegex.Replace(template.Name, string.Empty);

                template.ItemType = GetMatchValue(itemTypeRegex, setItemTemplate, "[", "]");

                if (itemBonusRegex.IsMatch(setItemTemplate))
                {
                    var rawBonus = GetMatchValue(itemBonusRegex, setItemTemplate, "(", ")");
                    template.Magic.Bonus = Convert.ToInt32(rawBonus);
                }

                if (specialAbilityRegex.IsMatch(setItemTemplate))
                {
                    var rawSpecialAbilities = GetMatchValue(specialAbilityRegex, setItemTemplate, "{", "}");
                    var specialAbilityNamees = rawSpecialAbilities.Split(',');

                    foreach (var specialAbilityName in specialAbilityNamees)
                    {
                        var specialAbility = new SpecialAbility { Name = specialAbilityName };
                        template.Magic.SpecialAbilities = template.Magic.SpecialAbilities.Union(new[] { specialAbility });
                    }
                }

                if (traitRegex.IsMatch(setItemTemplate))
                {
                    var rawTraits = GetMatchValue(traitRegex, setItemTemplate, "#");
                    var traits = rawTraits.Split(',');

                    foreach (var trait in traits)
                        template.Traits.Add(trait);
                }

                templates.Add(template);
            }

            return templates;
        }
 public void setAbility(SpecialAbility abt)
 {
     ability = abt;
     transform.FindChild ("AbilityName").GetComponentInChildren<Text> ().text = SpecialAbilitiesDescriptions.names[ability.EnumName];
 }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (textFieldControlName.Text.Length == 0)
            {
                MessageBox.Show(string.Format(Language.GetLocalizedString("INSTRUCTIONS_NAME"), Language.GetLocalizedString("SPECIAL_ABILITY")));
                return;
            }

            Dictionary<string, int> dict = new Dictionary<string, int>();
            foreach (Control ctrl in tabPageAttributes.Controls)
            {
                int value;
                if (ctrl is TextFieldControl && ctrl.Tag != null)
                {
                    if (Int32.TryParse((ctrl as TextFieldControl).Text, out value))
                    {
                        dict.Add(ctrl.Name.Substring(ctrl.Name.Length - 3), value);
                    }
                    else
                    {
                        if (ctrl.Text.Length != 0)
                        {
                            MessageBox.Show(String.Format(Language.GetLocalizedString("INVALID_ENTRY_UNSUPPORTED"), ctrl.Text));
                            return;
                        }
                    }
                }
            }

            SpecialAbility sa = new SpecialAbility();
            //Basics tab
            sa.Name = textFieldControlName.Text;
            sa.Description = textBoxDescription.Text;

            //Attributes Tab
            sa.AttributeBonus = dict;

            //Proficiencies Tab
            List<string> profs = new List<String>();
            foreach (object prof in comboBoxProfAdded.Items)
            {
                profs.Add(prof.ToString());
            }
            sa.ProficienciesAdded = profs;

            Dictionary<string, string> profsValue = new Dictionary<string, string>();
            foreach (object prof in comboBoxProfValue.Items)
            {
                profsValue.Add(prof.ToString().Substring(0, prof.ToString().IndexOf('-')),
                    prof.ToString().Substring(prof.ToString().IndexOf('-') + 1));
            }
            sa.ProficienciesAltered = profsValue;

            //Spells tab
            List<string> spells = new List<string>();
            foreach (object spell in comboBoxSpellsAdded.Items)
            {
                spells.Add(spell.ToString());
            }
            sa.SpellsAdded = spells;

            //Misc tab
            sa.SpeedIncrease = textFieldControlSpeed.Text;
            sa.ACBonus = textFieldControlAC.Text;

            //Now....save it.
            Data.AddSA(sa);

            ClearForm();
            UpdateIndex();
            comboBoxFieldSAName.ComboBox.SelectedIndex = comboBoxFieldSAName.ComboBox.FindStringExact(sa.Name);
        }