protected void CharacterSheet_Click(object sender, EventArgs e)
    {
        //If there is no logged in user hide the form and return.
        if (Request["k"] != "L0ngnubby")
        {
            return;
        }

        if (CharacterSheetXML.PostedFile.FileName == null || CharacterSheetXML.PostedFile.FileName == "")
            return; //No file?
        #region File Extension Check
        string[] split = CharacterSheetXML.PostedFile.FileName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
        switch (split[split.Length - 1].ToLower())
        {
            case "xml":
                break;
            default://I don't know this extension
                return;
        }

        #endregion
        string fileName = Guid.NewGuid().ToString() + "." + split[split.Length - 1].ToLower();
        //Write the file to disk
        StreamReader SR = new StreamReader(CharacterSheetXML.PostedFile.InputStream);
        XmlDocument sheet = new XmlDocument();
        sheet.LoadXml(SR.ReadToEnd());

        BaseStats baseStats = null;
        int MaxHP;

        XmlNodeList xList, xList2;

        xList = sheet.GetElementsByTagName("health");
        if (xList.Count > 0)
        {
            MaxHP = Convert.ToInt32(sheet.GetElementsByTagName("health")[0].Attributes["effective"].Value);
        }
        else MaxHP = 0;
        xList = sheet.GetElementsByTagName("baseStats");
        xList2 = sheet.GetElementsByTagName("secondBar");
        if (xList.Count > 0 && xList2.Count > 0)
        {
            baseStats = new BaseStats(xList[0], MaxHP, xList2[0]);
        }
        Response.Write(baseStats._2ndBar.effective.ToString() + " " + baseStats._2ndBar.Casting + " " + baseStats._2ndBar.NotCasting + " " + baseStats._2ndBar.PerFive);

        RequestData.SqlConnectionString = ""; // Omitted for Git Hub
        PostData.PostCharacterSheetXML(sheet, Request["r"], Request["cn"]);
    }
Beispiel #2
0
        public float CalculateDamage(GameObject instigator, Health target, Weapon weapon)
        {
            attackerStats      = instigator.GetComponent <BaseStats>();
            attackerLevel      = attackerStats.GetLevel();
            attackerCritChange = attackerStats.GetStat(Stat.CritPercentage);
            weaponDamage       = weapon.WeaponDamage;
            weaponSpeed        = weapon.WeaponSpeed;

            defenderStats = target.GetComponent <BaseStats>();
            defenderLevel = defenderStats.GetLevel();

            float hitChance = random.Next(1, 100);

            if (hitChance <= (hitEqualLevel + hitChangePrLevel * (attackerLevel - defenderLevel)))
            {
                if (weapon.IsMagicAttack)
                {
                    return(CalculateMagicDamage());
                }
                else
                {
                    return(CalculateMeleeDamage());
                }
            }
            else //miss
            {
                Debug.Log("Miss");
                return(0f);
            }
        }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        BaseStats test = (BaseStats)target;

        string path = Application.dataPath + "/" + "SavedData.Xml";

        GUILayout.BeginHorizontal();
        bool saveButton = GUILayout.Button("Save");
        bool loadButton = GUILayout.Button("Load");

        GUILayout.EndHorizontal();

        if (saveButton)
        {
            var saver = new SaveLoad();

            saver.Save(test, path);

            Debug.Log("saved. " + path);
        }

        if (loadButton)
        {
            var loader = new SaveLoad();

            test.agility = loader.Load(path).agility;

            Debug.Log("Loaded");
            Debug.Log(test.agility);
        }
    }
Beispiel #4
0
        private float GetBarterDiscount()
        {
            BaseStats baseStats = currentShopper.GetComponent <BaseStats>();
            float     discount  = baseStats.GetStat(Stat.BuyingDiscountPercentage);

            return(1 - Mathf.Min(discount, maximumBarterDiscount) / 100);
        }
    void Start()
    {
        baseStats = GameObject.Find("Base Stats").GetComponent <BaseStats> ();

        image        = GetComponent <Image> ();
        image.sprite = closed;
    }
Beispiel #6
0
 // 将 Get Component 放在 Awake 里可以避免出现捕获不到组件的问题
 private void Awake()
 {
     animator      = GetComponent <Animator>();
     mover         = GetComponent <Mover>();
     stats         = GetComponent <BaseStats>();
     currentWeapon = new LazyValue <Weapon>(SetUpDefaultWeapon);
 }
Beispiel #7
0
 private void ApplyEquipableItemEffect(BaseStats target)
 {
     if (item.GetItemEffect() == ItemEffect.IncreaseStatTemporarily)
     {
         //target.ModifyStatByEquip(item.GetAttributeToModify(), item.GetAdditiveModifiers(), item);
     }
 }
Beispiel #8
0
    private void DoAreaAction(Collider col, float dmgRadius, int dmg, float distance)
    {
        Limb      lb = col.GetComponent <Limb>();
        BaseStats bs = col.GetComponent <BaseStats>();

        if (lb != null)
        {
            bs = lb.rootStats;

            if (!dmgBaseStats.Contains(lb.rootStats))
            {
                lb.explosionVelocity = new Limb.ExplosionVelocity(tr.position, damageForce, dmgRadius, forceUpwards);
            }
        }

        if ((lb == null || (lb != null && (bs == null || bs.curHealth <= 0))) && col.GetComponent <Rigidbody>() != null)
        {
            col.GetComponent <Rigidbody>().AddExplosionForce(damageForce, tr.position, dmgRadius, forceUpwards, ForceMode.Impulse);
        }

        if (bs != null && !dmgBaseStats.Contains(bs))
        {
            ApplyDamageStat(bs, dmg, distance, dmgRadius);
            dmgBaseStats.Add(bs);
        }
    }
Beispiel #9
0
 //Assigns the stat values, making the initial starting stats derived from the base stats
 public void StartStats(BaseStats b_Stats, StatsToBuff CheckStats)
 {
     CheckStats.player_HP         = b_Stats.hitPoints;
     CheckStats.player_Lifepoints = b_Stats.lifePoints;
     CheckStats.player_JumpForce  = b_Stats.jumpForce;
     CheckStats.player_MoveSpeed  = b_Stats.moveSpeed;
 }
    public void SetParent(Transform _main, PhotonView _mainNetwork)
    {
        main            = _main.GetComponent <BaseStats>();
        playerTransform = _main.transform;

        if (_main.tag == "Player")
        {
            playerTransform = _mainNetwork.transform;
            if (_mainNetwork.Owner.NickName != "")
            {
                nameText.text = _mainNetwork.Owner.NickName;
            }
            else if (_mainNetwork.IsMine)
            {
                nameText.text = "Player " + (RoomManager.singleton.playerIndex + 1);
            }
            else
            {
                nameText.text = "Player " + (RoomManager.singleton.GetPlayerIndex(_mainNetwork.Owner) + 1);
            }
        }

        mainCam = FindObjectOfType <Camera>();

        healthSlider.maxValue = main.maxHealth;
    }
Beispiel #11
0
        private void Awake()
        {
            baseStats = GetComponent <BaseStats>();

            // pass in a function
            health = new LazyValue <int>(GetInitialHealth);
        }
Beispiel #12
0
        /// <summary>Handle the command.</summary>
        /// <param name="monitor">Writes messages to the console and log file.</param>
        /// <param name="command">The command name.</param>
        /// <param name="args">The command arguments.</param>
        public override void Handle(IMonitor monitor, string command, ArgumentParser args)
        {
            // parse arguments
            if (!args.TryGet(0, "target", out string target))
            {
                return;
            }

            WorldActor entity = SGame.Instance.xEntityMaster.FindEntityByTag(target) as WorldActor;

            if (entity == null)
            {
                monitor.Log($"Target {target} not found", LogLevel.Info);
                return;
            }

            BaseStats stats = entity.xBaseStats;

            if (!args.TryGet(1, "stat", out string stat))
            {
                return;
            }

            // handle
            switch (target)
            {
            case "hp":
            {
                if (!args.TryGetInt(2, "value", out int value, required: false))
                {
                    monitor.Log($"Current hp is {stats.iHP}", LogLevel.Info);
                }
Beispiel #13
0
        public override StatsCollection GetFinalStats(IActor forActor)
        {
            if (new StackTrace().FrameCount > 1000)
            {
                throw new Exception("Looks like your about to have a stack overflow.  Are you calling GetFinalStats on an item whose requirements include a Stat check? Maybe switch to BaseStats");
            }

            if (!RequirementsMet(forActor))
            {
                return(new StatsCollection());
            }

            var clone = BaseStats.Clone();

            foreach (var adjective in Adjectives)
            {
                clone.Increase(adjective.GetFinalStats(forActor));
            }

            foreach (var adjective in Adjectives)
            {
                clone = adjective.Modify(clone);
            }

            return(clone);
        }
Beispiel #14
0
 private void LoadStatsInfo(BaseStats charStats)
 {
     specificMemberInfo.SetActive(true);
     partyMember.charName.text     = characterSelected.GetCharName().ToUpper();
     partyMember.level.text        = "LVL " + characterSelected.GetLevel();
     partyMember.charSprite.sprite = characterSelected.GetSprite();
     partyMember.charType.text     = charStats.GetStatType().ToString().ToUpper();
     if (charStats.GetStatusCondition() == StatusCondition.None)
     {
         partyMember.statusCondition.gameObject.SetActive(false);
     }
     else
     {
         partyMember.statusCondition.text = charStats.GetStatusCondition().ToString().ToUpper();
     }
     partyMember.hp.text                    = charStats.GetStat(StatsAtributte.Health) + "/" + charStats.GetStat(StatsAtributte.MaxHealth);
     partyMember.sp.text                    = charStats.GetStat(StatsAtributte.SkillPoints) + "/" + charStats.GetStat(StatsAtributte.MaxSkillPoints);
     partyMember.atack.text                 = charStats.GetStat(StatsAtributte.Attack).ToString();
     partyMember.defense.text               = charStats.GetStat(StatsAtributte.Defense).ToString();
     partyMember.magicAttack.text           = charStats.GetStat(StatsAtributte.MagicAttack).ToString();
     partyMember.magicDefense.text          = charStats.GetStat(StatsAtributte.MagicDefense).ToString();
     partyMember.lucky.text                 = charStats.GetStat(StatsAtributte.Lucky).ToString();
     partyMember.speed.text                 = charStats.GetStat(StatsAtributte.Speed).ToString();
     partyMember.xpToLevelUp.text           = charStats.GetStat(StatsAtributte.ExperienceReward) + "/" + charStats.GetStat(StatsAtributte.ExperienceToLevelUp).ToString();
     partyMember.xpToLevelUpSlider.maxValue = charStats.GetStat(StatsAtributte.ExperienceToLevelUp);
     partyMember.xpToLevelUpSlider.value    = charStats.GetStat(StatsAtributte.ExperienceReward);
 }
        private void Awake()
        {
            _experience = GetComponent<Experience>();
            _baseStats = GetComponent<BaseStats>();

            currentLevel = GetExperienceLevel();
        }
Beispiel #16
0
 // --- Constructors ---
 public Unit(string pmFirstName, string pmNickname, string pmLastName, GameExt pmGame, Profession pmProf)
     : base(pmGame, pmGame.models.get(pmProf.getUnitModelID()), 16f*Vector3.UnitY)
 {
     if(pmFirstName.Length> 10)
         pmFirstName=	pmFirstName.Substring(0, 10);
     if(pmLastName.Length> 8)
         pmLastName=	pmLastName.Substring(0, 8);
     if(pmNickname.Length> 10)
         pmNickname=	pmNickname.Substring(0, 10);
     firstName=	pmFirstName;
     lastName=	pmLastName;
     nickname=	pmNickname;
     prof=	pmProf;
     color=	game.getColor("black");
     texture=	game.textures.get("unit_uv");
     pos+=	Vector3.UnitY*16f;
     mapPos=	new int[]	{-1, -1};
     isWalkingDone=	false;
     isAttackingDone=	false;
     originalStats=	new int[8];
     battleStats=	new int[8];
     pExp=	0;
     pLevel=	1;
     statEffects=	new List<StatEffect>();
     isAI=	false;
     statVariance=	new BaseStats(
         0, 0, // HP, Mana
         0, 0, // Atk, Def
         0, 0, // Mag, Res
         0, 0 // Spd, Move
     );
 }
Beispiel #17
0
        /// <summary>
        /// Checks if this ItemEntity can be stacked with another ItemEntity. To stack, both items must contain the same
        /// stat modifiers, name, description, value, and graphic index.
        /// </summary>
        /// <param name="source">Item to check if can stack on this ItemEntity.</param>
        /// <returns>True if the two items can stack on each other, else false.</returns>
        public bool CanStack(ItemEntity source)
        {
            // Check for equal reference
            if (ReferenceEquals(this, source))
            {
                // Although it makes sense for an ItemEntity to be able to stack onto itself,
                // there is no reason this should ever happen intentionally
                const string errmsg =
                    "Trying to stack an ItemEntity `{0}` onto itself. Although this is not an error, " +
                    "it makes no sense why it would be attempted.";
                if (log.IsWarnEnabled)
                {
                    log.WarnFormat(errmsg, this);
                }
                Debug.Fail(string.Format(errmsg, this));
                return(true);
            }

            // Check for non-equal values
            if (Value != source.Value || GraphicIndex != source.GraphicIndex || Type != source.Type || Name != source.Name ||
                Description != source.Description || Range != source.Range || WeaponType != source.WeaponType)
            {
                return(false);
            }

            // Check for non-equal stats
            if (!BaseStats.HasSameValues(source.BaseStats) || !ReqStats.HasSameValues(source.ReqStats))
            {
                return(false);
            }

            // Everything important is equal, so they can be stacked
            return(true);
        }
    public BaseCharacter()
    {
        CharacterName = "Character";
        Stats         = new BaseStats();
        Skills        = new List <BaseSkill>();
        Schools       = new List <BaseSchool>();

        Stats.BaseHealth     = 300;
        Stats.BaseMaxHealth  = 300;
        Stats.BaseAttack     = 30;
        Stats.BaseDefense    = 30;
        Stats.BasePower      = 30;
        Stats.BaseResistance = 30;
        Stats.BaseSpeed      = 30;

        Stats.BaseShield                  = 5;
        Stats.BaseResilience              = 0;
        Stats.BaseRetaliations            = 1;
        Stats.BaseRetaliationDamage       = 5;
        Stats.BaseComboPoints             = 0;
        Stats.BaseMaxComboPoints          = 3;
        Stats.BaseActionPoints            = 4;
        Stats.BaseMaxActionPoints         = 4;
        Stats.BaseGlobalCooldownReduction = 0;
        Stats.SameSchoolBonus             = 0.1f;

        MoveSpeed = 0.5f;

        Level              = 0;
        Experience         = 0;
        moveAnimationSpeed = 1.5f;
    }
Beispiel #19
0
 private void Awake()
 {
     m_Animator        = GetComponent <Animator>();
     m_ActionScheduler = GetComponent <ActionScheduler>();
     m_BaseStats       = GetComponent <BaseStats>();
     m_HealthPoints    = new LazyValue <float>(GetInitialHealth);
 }
Beispiel #20
0
        public void AbilityDK_IcyTouch_Basic()
        {
            // TODO: Get this so we don't have to do this work every test.
            Stats characterStats = new Stats();

            characterStats = BaseStats.GetBaseStats(85, CharacterClass.DeathKnight, CharacterRace.Undead);

            CombatState state = new CombatState();

            state.m_Stats   = characterStats as StatsDK;
            state.m_Talents = new DeathKnightTalents();

            // We're going to create IcyTouch and ensure that we can access everything for that
            // ability that is used by a DK.

            /*
             * AbilityDK_IcyTouch IT = new AbilityDK_IcyTouch(state);
             *
             * // Frost Fever application. is skipped for the purposes of this test.
             * Assert.IsTrue(IT.szName == "Icy Touch", "Name");
             * Assert.AreEqual(IT.AbilityCost[(int)DKCostTypes.Blood], 0, "Blood Cost");
             * Assert.AreEqual(IT.AbilityCost[(int)DKCostTypes.Frost], 1, "Frost Cost");
             * Assert.AreEqual(IT.AbilityCost[(int)DKCostTypes.UnHoly], 0, "Unholy Cost");
             * Assert.AreEqual(-10, IT.AbilityCost[(int)DKCostTypes.RunicPower], "RP Cost/Gain");
             * Assert.AreEqual((uint)((245 + 227) / 2), IT.uBaseDamage, "Base Damage");
             * Assert.AreEqual(20u, IT.uRange, "Range");
             * Assert.AreEqual(IT.tDamageType, ItemDamageType.Frost, "Damage Type");
             * Assert.AreEqual(IT.Cooldown, 1500u, "Cooldown");
             * // With the addition of GetTotalDamage function we need to add it into the basic IT check.
             * Assert.AreEqual((int)IT.uBaseDamage, IT.GetTotalDamage(), "GetTotalDamage");
             * */
        }
 private void Awake()
 {
     animator       = GetComponent <Animator>();
     actionSheduler = GetComponent <ActionSheduler>();
     baseStats      = GetComponent <BaseStats>();
     expPopup       = GameObject.FindGameObjectWithTag("ExperiencePopup").GetComponent <ExperiencePopup>();
 }
Beispiel #22
0
        public void UseEquipItem(int member)
        {
            if (indexOfSelectItem < 0)
            {
                return;
            }

            ItemConfig itemToUse = playerInventory.GetItemInSlot(indexOfSelectItem);
            BaseStats  target    = playerTeam.GetPlayerTeam()[member].GetStats();

            if (itemToUse.GetItemType() == ItemType.NoEffect)
            {
                return;
            }
            if (itemToUse.GetItemType() == ItemType.Equipable)
            {
                return;
            }

            itemToUse.Use(target);
            playerInventory.RemoveItem(playerInventory.GetItemInSlot(indexOfSelectItem), 1);
            ResetSelectedItem();

            panelUseFor.SetActive(false);
        }
Beispiel #23
0
    // Update is called once per frame
    void Update()
    {
        BaseStats stats = GameObject.Find("Player(Clone)").GetComponent <CombatScript>().stats;

        fill            = (float)stats.health / (float)stats.maxHealth;
        healthText.text = "Health: " + GameObject.Find("Player(Clone)").GetComponent <CombatScript>().stats.health.ToString();
    }
Beispiel #24
0
        public void BuildIvsEvs(PokemonStats[] stats)
        {
            foreach (var stat in stats)
            {
                StatTypeEnum type = StatTypeEnum.ATK;
                switch (stat.Stat.Name)
                {
                case "speed":
                    type = StatTypeEnum.SPEED;
                    break;

                case "special-defense":
                    type = StatTypeEnum.SP_DEF;
                    break;

                case "special-attack":
                    type = StatTypeEnum.SP_ATK;
                    break;

                case "defense":
                    type = StatTypeEnum.DEF;
                    break;

                case "attack":
                    type = StatTypeEnum.ATK;
                    break;

                case "hp":
                    type = StatTypeEnum.HP;
                    break;
                }
                BaseStats.Add(type, stat.BaseValue);
                EffortStats.Add(type, stat.Effort);
            }
        }
Beispiel #25
0
        /// <summary>
        /// Instant, 1 min cd, Self (Any)
        /// Generates 10 rage at the cost of health and then generates an additional 10 rage over 10 sec.
        /// </summary>
        /// <TalentsAffecting>Improved Bloodrge [+(25*Pts)% Rage Generated], Intensify Rage [-(1/9*Pts]% Cooldown]</TalentsAffecting>
        /// <GlyphsAffecting>Glyph of Bloodrage [-100% Health Cost]</GlyphsAffecting>
        public Bloodrage(Character c, Stats s, CombatFactors cf, WhiteAttacks wa, CalculationOptionsDPSWarr co, BossOptions bo)
        {
            Char = c; StatS = s; combatFactors = cf; Whiteattacks = wa; CalcOpts = co; BossOpts = bo;
            //
            Name         = "Bloodrage";
            Description  = "Generates 10 rage at the cost of health and then generates an additional 10 rage over 10 sec.";
            AbilIterater = (int)Rawr.DPSWarr.CalculationOptionsDPSWarr.Maintenances.Bloodrage_;
            Cd           = 60f * (1f - 1f / 9f * Talents.IntensifyRage); // In Seconds
            Duration     = 10f;                                          // In Seconds
            // Rage is actually reversed in the rotation
            RageCost = -(20f                                             // Base
                         + 10f)                                          // Over Time
                       * (1f + Talents.ImprovedBloodrage * 0.25f);       // Talent Bonus
            StanceOkArms = StanceOkDef = StanceOkFury = true;
            Stats Base       = BaseStats.GetBaseStats(Char.Level, CharacterClass.Warrior, Char.Race);
            float baseHealth = Base.Health + StatConversion.GetHealthFromStamina(Base.Stamina, CharacterClass.Warrior);

            HealingBase  = -1f * (float)Math.Floor(baseHealth) * 0.16f;
            HealingBonus = (Talents.GlyphOfBloodrage ? 0f : 1f);
            UseHitTable  = false;
            UsesGCD      = false;
            UseReact     = true;
            //
            Initialize();
        }
    void Start()
    {
        baseStats = GameObject.Find("Base Stats").GetComponent <BaseStats> ();
        manager   = GameObject.Find("UI").GetComponent <UIManager> ();

        transform.GetChild(0).GetComponent <Text>().text = "" + cost;
    }
Beispiel #27
0
 public PokemonUiData(BotWindowData ownerBot, ulong id, PokemonId pokemonid, string name, //BitmapSource img,
                      int cp, double iv, PokemonFamilyId family, int candy, ulong stamp, bool fav, bool inGym, double level,
                      PokemonMove move1, PokemonMove move2, PokemonType type1, PokemonType type2, int maxCp, BaseStats baseStats,
                      int stamina, int maxStamina, int possibleCp, int candyToEvolve)
 {
     OwnerBot  = ownerBot;
     Favoured  = fav;
     InGym     = inGym;
     Id        = id;
     PokemonId = pokemonid;
     //Image = img;
     Name          = name;
     Cp            = cp;
     Iv            = iv;
     Candy         = candy;
     Family        = family;
     Timestamp     = stamp;
     Level         = level;
     Move1         = move1;
     Move2         = move2;
     Type1         = type1;
     Type2         = type2;
     MaxCp         = maxCp;
     Stats         = baseStats;
     Stamina       = stamina;
     MaxStamina    = maxStamina;
     CandyToEvolve = candyToEvolve;
     PossibleCp    = possibleCp;
 }
Beispiel #28
0
    public static Pokemon GenerateRandomPokemon(int pokedexNum)
    {
        //Get JSON file from PokeAPI that cooresponds to this pokedex number
        string  json = GetPokemonJSON(pokedexNum);
        JObject obj  = JObject.Parse(json);

        //parse data from the JSON file
        int                       pokemonLevel       = new Random().Next(Pokemon.MAX_POKEMON_LEVEL + 1); //so the level is in [0, MAX_POKEMON_LEVEL]
        string                    name               = FirstLetterToUpper(obj.GetValue("name").ToString());
        uint                      personalityValue   = Pokemon.GeneratePersonalityValue();
        List <string>             types              = GetTypes(obj);
        Nature                    nature             = Nature.natures[personalityValue % 25];
        List <Ability>            abilities          = GetAbilities(obj);
        Dictionary <string, Stat> stats              = GetStats(obj);
        int                       baseEXPYield       = Int32.Parse(obj.GetValue("base_experience").ToString());
        int                       genderThreshold    = 50;                //placeholder
        int                       eggCyclesTillHatch = 10;                //placeholder
        int                       baseFriendship     = 70;                //placeholder
        string                    levelingRate       = "Medium Slow";     //placeholder
        List <string>             eggGroups          = GetEggGroups(obj); //not implemented yet
        string                    pokedexColor       = "";                //placeholder
        float                     height             = 5.5f;              //placeholder
        float                     weight             = (float)System.Convert.ToDouble(obj.GetValue("weight").ToString());

        //return the generated Pokemon
        BaseStats baseStats = new BaseStats(name, personalityValue, types, nature, abilities, stats, baseEXPYield, genderThreshold,
                                            eggCyclesTillHatch, baseFriendship, levelingRate, eggGroups, pokedexColor, height, weight);

        return(new Pokemon(new PokedexID(name, pokedexNum), pokemonLevel, baseStats));
    }
Beispiel #29
0
    public Attributes(BaseStats baseStats, StateMachine stateMachine)
    {
        this.baseStats    = baseStats;
        this.stateMachine = stateMachine;

        Initialize();
    }
Beispiel #30
0
 private void Awake()
 {
     mover          = GetComponent <Mover>();
     actionSchedule = GetComponent <ActionSchedule>();
     animator       = GetComponent <Animator>();
     baseStats      = GetComponent <BaseStats>();
 }
Beispiel #31
0
        // Animation Event
        void Hit()
        {
            if (target == null)
            {
                return;
            }

            float     damage          = GetComponent <BaseStats>().GetStat(Stat.Damage);
            BaseStats targetBaseStats = target.GetComponent <BaseStats>();

            if (targetBaseStats != null)
            {
                float defence = targetBaseStats.GetStat(Stat.Defence);
                damage /= 1 + defence / damage;
            }

            if (currentWeapon.value != null)
            {
                currentWeapon.value.OnHit();
            }

            if (currentWeaponConfig.HasProjectile())
            {
                currentWeaponConfig.LaunchProjectile(rightHandTransform, leftHandTransform, target, gameObject, damage);
            }
            else
            {
                target.TakeDamage(gameObject, damage);
            }
        }
Beispiel #32
0
 public void Use(BaseStats target)
 {
     if (itemType == ItemType.BattleItem)
     {
         ApplyBattleItemEffect(target);
     }
     else if (itemType == ItemType.Consumable)
     {
         ApplyConsumableItemEffect(target);
     }
     else if (itemType == ItemType.Equipable)
     {
         return;
     }
     else if (itemType == ItemType.TimeEffect)
     {
         ApplyTimeEffectItem();
     }
     else if (itemType == ItemType.StatusCondition)
     {
         ApplyStatusConditionEffect(target);
     }
     else if (itemType == ItemType.NoEffect)
     {
         Debug.Log("It's not an usable item");
     }
 }
Beispiel #33
0
 // --- Constructors ---
 public Profession(GameExt pmGame, string name, string pmRegname, BaseStats stats)
 {
     game=	pmGame;
     Name=	name;
     Stats=	stats;
     passives=	new HashTable<Passive>(4);
     currPassives=	new string[3];
     updatingAI=	false;
     pRegname=	pmRegname;
 }
Beispiel #34
0
 protected override void ReadPacket(BinaryReader reader)
 {
     Stats = new BaseStats(reader);
 }
Beispiel #35
0
 void Start()
 {
     baseStats = GetComponent<BaseStats> ();
 }
Beispiel #36
0
        private void AddMageStats(BaseStats stats)
        {
            // Osamodas does not have the same Chance stats as other Mages (feca, xelor, eniripsa) So...

            Func<int> normalMageChanceFunc = delegate
            {
                if (Stats.Chance.Base <= 20)
                    return 1;
                if (Stats.Chance.Base <= 40)
                    return 2;
                if (Stats.Chance.Base <= 60)
                    return 3;
                if (Stats.Chance.Base <= 80)
                    return 4;
                if (Stats.Chance.Base >= 81)
                    return 5;
                return 0;
            };

            Func<int> osaChanceFunc = delegate
            {
                if (Stats.Chance.Base <= 100)
                    return 1;
                if (Stats.Chance.Base <= 200)
                    return 2;
                if (Stats.Chance.Base <= 300)
                    return 3;
                if (Stats.Chance.Base <= 400)
                    return 4;
                if (Stats.Chance.Base >= 401)
                    return 5;
                return 0;
            };

            AddGeneralStats(stats,
                () =>
                {
                    if (Stats.Intelligence.Base <= 100)
                        return 1;
                    if (Stats.Intelligence.Base <= 200)
                        return 2;
                    if (Stats.Intelligence.Base <= 300)
                        return 3;
                    if (Stats.Intelligence.Base <= 400)
                        return 4;
                    if (Stats.Intelligence.Base >= 401)
                        return 5;
                    return 0;
                },
                Classe != Class.Osamodas
                    ? normalMageChanceFunc
                    : osaChanceFunc,
                () =>
                {
                    if (Stats.Agility.Base <= 20)
                        return 1;
                    if (Stats.Agility.Base <= 40)
                        return 2;
                    if (Stats.Agility.Base <= 60)
                        return 3;
                    if (Stats.Agility.Base <= 80)
                        return 4;
                    if (Stats.Agility.Base >= 81)
                        return 5;
                    return 0;
                },
                () =>
                {
                    if (Stats.Strength.Base <= 50)
                        return 2;
                    if (Stats.Strength.Base <= 150)
                        return 3;
                    if (Stats.Strength.Base <= 250)
                        return 4;
                    if (Stats.Strength.Base >= 251)
                        return 5;
                    return 0;
                });
        }
Beispiel #37
0
 private void AddPandaStats(BaseStats stats)
 {
     AddGeneralStats(stats,
         () =>
         {
             if (Stats.Intelligence.Base <= 50)
                 return 1;
             if (Stats.Intelligence.Base <= 200)
                 return 2;
             if (Stats.Intelligence.Base >= 201)
                 return 3;
             return 0;
         },
         () =>
         {
             if (Stats.Chance.Base <= 50)
                 return 1;
             if (Stats.Chance.Base <= 200)
                 return 2;
             if (Stats.Chance.Base >= 201)
                 return 3;
             return 0;
         },
         () =>
         {
             if (Stats.Agility.Base <= 50)
                 return 1;
             if (Stats.Agility.Base <= 200)
                 return 2;
             if (Stats.Agility.Base >= 201)
                 return 3;
             return 0;
         },
         () =>
         {
             if (Stats.Strength.Base <= 50)
                 return 1;
             if (Stats.Strength.Base <= 200)
                 return 2;
             if (Stats.Strength.Base >= 201)
                 return 3;
             return 0;
         });
 }
Beispiel #38
0
 private void AddIopStats(BaseStats stats)
 {
     AddGeneralStats(stats,
         () =>
         {
             if (Stats.Intelligence.Base <= 20)
                 return 1;
             if (Stats.Intelligence.Base <= 40)
                 return 2;
             if (Stats.Intelligence.Base <= 60)
                 return 3;
             if (Stats.Intelligence.Base <= 80)
                 return 4;
             if (Stats.Intelligence.Base >= 81)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Chance.Base <= 20)
                 return 1;
             if (Stats.Chance.Base <= 40)
                 return 2;
             if (Stats.Chance.Base <= 60)
                 return 3;
             if (Stats.Chance.Base <= 80)
                 return 4;
             if (Stats.Chance.Base >= 81)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Agility.Base <= 20)
                 return 1;
             if (Stats.Agility.Base <= 40)
                 return 2;
             if (Stats.Agility.Base <= 60)
                 return 3;
             if (Stats.Agility.Base <= 80)
                 return 4;
             if (Stats.Agility.Base >= 81)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Strength.Base <= 100)
                 return 1;
             if (Stats.Strength.Base <= 200)
                 return 2;
             if (Stats.Strength.Base <= 300)
                 return 3;
             if (Stats.Strength.Base <= 400)
                 return 4;
             if (Stats.Strength.Base >= 401)
                 return 5;
             return 0;
         });
 }
Beispiel #39
0
        private void AddGeneralStats(BaseStats stats, Func<int> intellAction, Func<int> chanceAction,
            Func<int> agilityAction, Func<int> strengthAction)
        {
            switch (stats)
            {
                case BaseStats.Vitality:
                    const int statsPointVitalityBoost = 1;

                    if (StatsPoints >= statsPointVitalityBoost)
                    {
                        Stats.Vitality.Base += Classe == Class.Sacrieur ? 3 : 1;
                        PdvNow += Classe == Class.Sacrieur ? 3 : 1;
                        PdvMax += Classe == Class.Sacrieur ? 3 : 1;
                    }

                    StatsPoints -= statsPointVitalityBoost;
                    break;
                case BaseStats.Wisdom:
                    const int statsPointWisdomBoost = 3;

                    if (StatsPoints >= statsPointWisdomBoost)
                        Stats.Wisdom.Base += 1;

                    StatsPoints -= statsPointWisdomBoost;
                    break;
                case BaseStats.Strength:
                    var statsPointStrengthBoost = strengthAction();

                    if (StatsPoints >= statsPointStrengthBoost)
                        Stats.Strength.Base += 1;

                    StatsPoints -= statsPointStrengthBoost;
                    break;
                case BaseStats.Intelligence:
                    var statsPointIntelligenceBoost = intellAction();

                    if (StatsPoints >= statsPointIntelligenceBoost)
                        Stats.Intelligence.Base += 1;

                    StatsPoints -= statsPointIntelligenceBoost;
                    break;
                case BaseStats.Chance:
                    var statsPointChanceBoost = chanceAction();

                    if (StatsPoints >= statsPointChanceBoost)
                        Stats.Chance.Base += 1;

                    StatsPoints -= statsPointChanceBoost;
                    break;
                case BaseStats.Agility:
                    var statsPointAgilityBoost = agilityAction();

                    if (StatsPoints >= statsPointAgilityBoost)
                        Stats.Agility.Base += 1;

                    StatsPoints -= statsPointAgilityBoost;
                    break;
            }
        }
Beispiel #40
0
 private void AddEnuStats(BaseStats stats)
 {
     AddGeneralStats(stats,
         () =>
         {
             if (Stats.Intelligence.Base <= 20)
                 return 1;
             if (Stats.Intelligence.Base <= 60)
                 return 2;
             if (Stats.Intelligence.Base <= 100)
                 return 3;
             if (Stats.Intelligence.Base <= 140)
                 return 4;
             if (Stats.Intelligence.Base >= 141)
                 return 5;
             return 0;
         },
         () =>
         {
             if (Stats.Chance.Base <= 100)
                 return 1;
             if (Stats.Chance.Base <= 150)
                 return 2;
             if (Stats.Chance.Base <= 230)
                 return 3;
             if (Stats.Chance.Base <= 330)
                 return 4;
             if (Stats.Chance.Base >= 331)
                 return 5;
             return 0;
         },
         () =>
         {
             if (Stats.Agility.Base <= 20)
                 return 1;
             if (Stats.Agility.Base <= 40)
                 return 2;
             if (Stats.Agility.Base <= 60)
                 return 3;
             if (Stats.Agility.Base <= 80)
                 return 4;
             if (Stats.Agility.Base >= 81)
                 return 5;
             return 0;
         },
         () =>
         {
             if (Stats.Strength.Base <= 50)
                 return 1;
             if (Stats.Strength.Base <= 150)
                 return 2;
             if (Stats.Strength.Base <= 250)
                 return 3;
             if (Stats.Strength.Base <= 350)
                 return 4;
             if (Stats.Strength.Base >= 351)
                 return 5;
             return 0;
         });
 }
Beispiel #41
0
 public void BoostStats(BaseStats stats)
 {
     switch (Classe)
     {
         case Class.Feca:
         case Class.Xelor:
         case Class.Eniripsa:
         case Class.Osamodas:
             AddMageStats(stats);
             break;
         case Class.Enutrof:
             AddEnuStats(stats);
             break;
         case Class.Sram:
             AddSramStats(stats);
             break;
         case Class.Iop:
             AddIopStats(stats);
             break;
         case Class.Cra:
             AddCraStats(stats);
             break;
         case Class.Ecaflip:
             AddEcaStats(stats);
             break;
         case Class.Sadida:
             AddSadiStats(stats);
             break;
         case Class.Sacrieur:
             AddSacriStats(stats);
             break;
         case Class.Pandawa:
             AddPandaStats(stats);
             break;
     }
 }
Beispiel #42
0
 private void AddSacriStats(BaseStats stats)
 {
     AddGeneralStats(stats,
         () =>
         {
             if (Stats.Intelligence.Base <= 100)
                 return 3;
             if (Stats.Intelligence.Base <= 150)
                 return 4;
             if (Stats.Intelligence.Base >= 151)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Chance.Base <= 100)
                 return 3;
             if (Stats.Chance.Base <= 150)
                 return 4;
             if (Stats.Chance.Base >= 151)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Agility.Base <= 100)
                 return 3;
             if (Stats.Agility.Base <= 150)
                 return 4;
             if (Stats.Agility.Base >= 151)
                 return 4;
             return 0;
         },
         () =>
         {
             if (Stats.Strength.Base <= 100)
                 return 3;
             if (Stats.Strength.Base <= 150)
                 return 4;
             if (Stats.Strength.Base >= 151)
                 return 4;
             return 0;
         });
 }
    void CreateUI()
    {
        //---------------Actions---------------------------------------------
        //create canvas and parent it to the agent
        agentCanvas = ((GameObject)Instantiate (agentCanvasPrefab.gameObject, Vector3.zero, Quaternion.identity)).GetComponent<Canvas>();
        agentCanvas.transform.SetParent (this.transform);
        agentCanvas.transform.name = "Action Canvas";
        agent.agentCanvas = agentCanvas;
        //set canvas event camera and position in terms of the agent
        agentCanvas.worldCamera = Camera.main;
        agentCanvas.sortingOrder = 1;
        agentCanvas.transform.localPosition = new Vector3 (0f, 2f, 0f);
        //create buttons
        foreach (AgentActions.ActionData actionData in actionDataList) {
            //bumps up canvas by .3 everytime a new action is added to the list
            agentCanvas.transform.localPosition += new Vector3 (0f, .3f, 0f);
            //create button
            GameObject buttonObject = (GameObject)Instantiate (actionButtonPrefab.gameObject);
            //change name of button
            buttonObject.transform.name = actionData.action.actionName + " Button";
            //set parent to canvas
            buttonObject.transform.SetParent (agentCanvas.transform);
            //zero out button position
            buttonObject.transform.localPosition = Vector3.zero;
            //change text of button
            buttonObject.GetComponentInChildren<Text> ().text = actionData.action.actionName;
            //change action associated with button
            buttonObject.GetComponent<ButtonActionInfo> ().actionData = actionData;
            actionData.button = buttonObject.GetComponent<Button>();
            //change button's onClick
            buttonObject.GetComponent<Button> ().onClick.AddListener (() => {
                buttonObject.GetComponent<ButtonActionInfo> ().SetBattleManagerAction ();});
            //change button colors
            ColorBlock buttonColors = buttonObject.GetComponent<Button> ().colors;
            buttonColors.normalColor = actionData.action.normalColor;
            buttonColors.highlightedColor = actionData.action.highlightedColor;
            buttonColors.pressedColor = actionData.action.pressedColor;
            buttonColors.disabledColor = actionData.action.disabledColor;
            buttonObject.GetComponent<Button> ().colors = buttonColors;
            //change button text color
            if (buttonColors.normalColor != Color.white) {
                //if button color is not white, the text should be white
                buttonObject.GetComponentInChildren<Text> ().color = Color.white;
            } else {
                //else text should be black
                buttonObject.GetComponentInChildren<Text> ().color = Color.black;
            }
            //if action is not usable than disable it
            if (!actionData.usable) {
                buttonObject.GetComponent<Button> ().interactable = false;
            }
            //if action is not known, disable the game object
            if (!actionData.known) {
                buttonObject.SetActive (false);
            }
            //scale button down
            buttonObject.transform.localScale = new Vector3 (1.5f, 1.5f, 1.5f);
            //add button to list
            actionButtonList.Add (buttonObject.GetComponent<Button>());
        }
        //set ui to false
        agentCanvas.SetActive (false);

        //--------------Healthbar-------------------------------------
        //needs a new canvas, set up same way as action button canvas
        agentHUDCanvas = (GameObject)Instantiate (agentHUDCanvasPrefab.gameObject, Vector3.zero, Quaternion.identity);
        agentHUDCanvas.transform.SetParent (this.transform);
        agentHUDCanvas.transform.name = "HUD Canvas";
        //set canvas event camera and position in terms of the agent
        agentHUDCanvas.GetComponent<Canvas> ().worldCamera = Camera.main;
        if(gameObject.GetComponent<TileAgent>().team == BattleManager.CombatTeam.Player)
            agentHUDCanvas.transform.localPosition = new Vector3 (0f,2.3f,0f);
        else
            agentHUDCanvas.transform.localPosition = new Vector3 (0f,1.6f,0f);
        healthbar = (GameObject)Instantiate (healthbarPrefab.gameObject);
        healthbar.transform.SetParent (agentHUDCanvas.transform);
        healthbar.name = "Health Bar";
        //zero out health position
        healthbar.transform.localPosition = Vector3.zero;
        healthbarSlider = healthbar.GetComponent<Slider> ();
        stats = GetComponent<BaseStats>();
        healthbarSlider.maxValue = stats.maxHealth;
        healthbarSlider.minValue = 0;
        healthbarSlider.value = stats.currentHealth;
        //scale healthbar
        healthbar.transform.localScale = new Vector3(1f,1f,0);
    }
Beispiel #44
0
    protected override void Awake()
    {
        _motor = GetComponent<TileMotor>();
        _modelRotControl = GetComponent<ModelRotationController>();
        _stats = GetComponent<BaseStats>();

        //Ensure model we have is synchronized
        if (_modelRotControl.modelTf == null && model != null) {//assign to rotation controller
            _modelRotControl.modelTf = model.transform;
        }
        else if (model == null && _modelRotControl.modelTf != null) {//get model from rotation controller
            model = _modelRotControl.gameObject;
        }
        RefreshTurn();
        base.Awake();
    }