//
// Get Ratios ---------------------------------------------------------------------------
//
    public static Stats AttributesToStats(Attributes attributes)
    {
        if (!initialized)
        {
            SetupSingleton();
        }


        AspectStats aspectStats = new AspectStats();
        CombatStats power       = new CombatStats();
        CombatStats resistance  = new CombatStats();


        foreach (AttributeEnum ae in System.Enum.GetValues(typeof(AttributeEnum)))
        {
            foreach (CombatStatEnum cse in System.Enum.GetValues(typeof(CombatStatEnum)))
            {
                power[cse]      += powerRatio[ae][cse] * attributes[ae];
                resistance[cse] += resistanceRatio[ae][cse] * attributes[ae];
            }

            foreach (AspectStatEnum aspectEnum in System.Enum.GetValues(typeof(AspectStatEnum)))
            {
                aspectStats[aspectEnum] += aspectRatio[ae][aspectEnum] * attributes[ae];
            }
        }


        return(new Stats(aspectStats, power, resistance));
    }
Exemple #2
0
 public Character()
 {
     PInfoStats   = new InfoStats( );
     PLevelStats  = new LevelStats( );
     PPointStats  = new PointStats( );
     PCombatStats = new CombatStats( );
 }
 public Station(string name, CombatStats combatStats, string iconName)
 {
     this.name        = name;
     this.combatStats = combatStats;
     this.iconName    = iconName;
     SetTexture(iconName);
 }
    //TODO: pass info stats parameter
    void FillClassInfoStats(CombatStats info)
    {
        float baseValue = ConstantValue.COMBAT_BASE_VALUE;

        UIAttack.Value  = info.Attack / baseValue;
        UIDefense.Value = info.Defend / baseValue;
        //UIBlock.Value = 1;
        UICritical.Value = info.Critical / baseValue;
        UIDodge.Value    = info.Dodge / baseValue;

        switch (mainClass)
        {
        case InfoStats.CLASS_TYPE.PALADIN:
            UIHeroName.SetSprite("Beast-Master");
            charSprite.SetSprite("beastmaster");
            break;

        case InfoStats.CLASS_TYPE.ARCHER:
            UIHeroName.SetSprite("Text_Gunner");
            charSprite.SetSprite("gunner");
            break;

        case InfoStats.CLASS_TYPE.ASSASSIN:
            UIHeroName.SetSprite("Text_Sorceress");
            charSprite.SetSprite("sorceress");
            break;
        }
    }
Exemple #5
0
    /****************************   HANDLES SETTING UP BATTLE   **********************************************/


    public void SetUpBattleScene()
    {
        //Find the stats
        _stats = GameObject.FindGameObjectWithTag("CombatStats").GetComponent <CombatStats>();
        foreach (Items i in itemList)
        {
            copyItems.Add(i);
        }

        //find the enemy parent
        _enemyParent  = GameObject.FindGameObjectWithTag("Enemy Parent");
        _enemyEffects = GameObject.FindGameObjectWithTag("Enemy Effects");

        PlaceEnemies();
        _stats.SetStats();

        _battleEnd   = _inBattle.Count - 1;
        _battleStart = 0;

        //Display player health
        GameManager.instance.healthParent.SetActive(true);
        GameManager.instance.battleAnimator.SetBool("IsOpen", true);

        ShowActionMenu();
    }
Exemple #6
0
        public AttackSummary Shoot(IEnemy enemy, CombatStats combatStats)
        {
            ValidateShoot(enemy, combatStats);

            int hitRoll = Rng.Roll(RollType.d20);

            AttackSummary summary;

            if (ShotMisfired(hitRoll))
            {
                HandleMisfire();
                summary = GetMisfireAttackSummary();
            }
            else
            {
                IModifier finalHitMod = HitModifier.Add(combatStats.HitModifier);
                IModifier finalDmgMod = DamageModifier.Add(combatStats.DamageModifier);

                summary = HandleShoot(enemy,
                                      hitRoll,
                                      finalHitMod,
                                      finalDmgMod,
                                      combatStats.CritValue);
            }

            DecrementCurrentAmmo();

            return(summary);
        }
Exemple #7
0
        public Station CreateStation(StationType type)
        {
            CombatStats stats;
            string      stationName;
            string      stationIcon;

            switch (type)
            {
            case (StationType.TestStation):
                stats       = new CombatStats(500, 1, 500, 1, 5, 20f);
                stationName = "Test Station";
                stationIcon = "station_icon";
                break;

            case (StationType.MiningStation):
                stats       = new CombatStats(700, 1, 300, 5, 2, 10f);
                stationName = "Mining Outpost";
                stationIcon = "mining_outpost";
                break;

            default:
                throw new System.Exception("Type of station not supported");
            }

            return(new Station(stationName, stats, stationIcon));
        }
Exemple #8
0
 //Find and activate the script for the current turn GO
 void ActivateGO()
 {
     //Using the turn index, access the script of the relative combatant and initialize
     _activeCombatant = _generator._sortedInit[_turnIndex];
     if (_activeCombatant._charName == "Player")
     {
         _player.Initialize();
         //Enable timer to allow camera time to move
         _waitingForSeconds = true;
     }
     else
     {
         _enemy = _activeCombatant._go.GetComponent <EnemyScript>();
         _enemy.Initialize();
         if (!_enemy._dead)
         {
             //Enable timer to allow camera time to move
             _waitingForSeconds = true;
         }
         else
         {
             NextTurn();
         }
     }
 }
Exemple #9
0
        private void ValidateShoot(IEnemy enemy, CombatStats combatStats)
        {
            Assert.IsNotNull(enemy);
            Assert.IsNotNull(combatStats);

            Assert.IsTrue(CanFire());
            Assert.IsTrue(HasShotLoaded());
        }
 public ActiveCurse(ActiveTick tick, CombatStats damage)
 {
     stats        = new Stats();
     percentStats = new Stats();
     attributes   = new Attributes();
     activeTick   = tick;
     base.damage  = damage;
 }
Exemple #11
0
 public Entity(Vector2 position, Vector2 velocity, Texture2D texture)
 {
     sprite = new Sprite(texture);
     Velocity = velocity;
     this.position = position;
     CombatState = new CombatStats();
     Status = new Alive();
 }
Exemple #12
0
 public Buff(bool percent, int duration, AttributeStats attributes, CharStats charStats, CombatStats combatStats)
 {
     this.percent     = percent;
     this.duration    = duration;
     this.attributes  = attributes;
     this.charStats   = charStats;
     this.combatStats = combatStats;
 }
    //Generates this character's Combat Stats
    private void GenerateCombatStats()
    {
        //Getting the reference ot this object's Combat Stats component
        CombatStats characterCombatStatsRef = this.GetComponent <CombatStats>();

        //Sets the base initiative
        characterCombatStatsRef.currentInitiativeSpeed = Random.Range(this.initiative.x, this.initiative.y);
    }
Exemple #14
0
    public void TutorialSetUp()
    {
        _stats        = GameObject.FindGameObjectWithTag("CombatStats").GetComponent <CombatStats>();
        _enemyParent  = GameObject.FindGameObjectWithTag("Enemy Parent");
        _enemyEffects = GameObject.FindGameObjectWithTag("Enemy Effects");

        PlaceEnemies();
    }
Exemple #15
0
 public MonsterObject(ICharacter character, bool isAttacker)
 {
     IsMonster  = true;
     IsAttacker = isAttacker;
     Character  = character;
     SetNextAttack();
     CombatStats = new CombatStats();
     Threat      = new Threat();
 }
Exemple #16
0
 public PlayerObject(ICharacter pc, bool isAttacker)
 {
     IsMonster  = false;
     IsAttacker = isAttacker;
     Character  = pc;
     SetNextAttack();
     CombatStats = new CombatStats();
     Threat      = new Threat();
 }
Exemple #17
0
        public Ship CreateShip(ShipType type)
        {
            CombatStats stats;

            string shipName;
            string shipIcon;
            float  speed;
            float  angularSpeed;

            switch (type)
            {
            case (ShipType.Test):
                stats        = new CombatStats(200, 200, 10, 40f);
                shipName     = "Test Ship";
                shipIcon     = "ship_icon";
                speed        = 5f;
                angularSpeed = 50f;
                break;

            case (ShipType.MotherShip):
                stats        = new CombatStats(2000, 1500, 15, 45f);
                shipName     = "MotherShip";
                shipIcon     = "ship_icon";
                speed        = 2f;
                angularSpeed = 17f;
                break;

            case (ShipType.ConstructionShip):
                stats        = new CombatStats(100, 100, 5, 45f);
                shipName     = "Construction Ship";
                shipIcon     = "construction_ship_icon";
                speed        = 3f;
                angularSpeed = 45f;
                break;

            case (ShipType.Freighter):
                stats        = new CombatStats(100, 100, 5, 45f);
                shipName     = "Freighter";
                shipIcon     = "freighter_icon";
                speed        = 2.5f;
                angularSpeed = 25f;
                break;

            case (ShipType.Destroyer):
                stats        = new CombatStats(600, 300, 4, 25f);
                shipName     = "Destroyer";
                shipIcon     = "destroyer";
                speed        = 2.5f;
                angularSpeed = 25f;
                break;

            default:
                throw new System.Exception("Type of ship not supported");
            }

            return(new Ship(shipName, stats, shipIcon, speed, angularSpeed));
        }
    // Use this for initialization
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Health = 100;

        combatStats1 = Weapon1.GetComponent<CombatStats> (); //get weapon 1's stats
        combatStats2 = Weapon2.GetComponent<CombatStats> (); //get weapon 2's stats

        currentWeaponState = combatStats1.WeaponType; //Set current weapon player is holding to weapon 1's(default) type
    }
Exemple #19
0
 public Task(GameObject owner)
 {
     this.owner        = owner;
     aiController      = owner.GetComponent <AIController>();
     combatStats       = owner.GetComponent <CombatStats>();
     taskMngr          = owner.GetComponent <TaskManager>();
     characterAnimator = owner.GetComponent <Animator>();
     navAgent          = owner.GetComponent <NavMeshAgent>();
     taskBehaviour     = ExecuteBehaviour;
 }
        public void Init(ref EcsEntity e, Character ch)
        {
            Entity    = e;
            Character = ch;
            BaseStats = new BaseStats();
            Stats     = new CombatStats();
            DamageQueue.Clear();

            Stats.Range = 2;
        }
Exemple #21
0
 void SubtractPowerResistance <T>(CombatStatEnum cse, Stats precursorStats, ref CombatStats power, ref CombatStats resistance, List <T> buffList) where T : AbstractEffect
 {
     foreach (AbstractEffect e in buffList)
     {
         power[cse]      += e.PowerValue(cse);
         resistance[cse] += e.ResistanceValue(cse);
         power[cse]      += e.PercentPowerValue(cse) * precursorStats.PowerValue(cse) / 100;
         resistance[cse] += e.ResistanceValue(cse) * precursorStats.ResistanceValue(cse) / 100;
     }
 }
Exemple #22
0
    public CombatStats(CombatStats stats)
    {
        FieldInfo[] fields1 = GetType().GetFields();
        FieldInfo[] fields2 = stats.GetType().GetFields();

        for (int i = 0; i < fields1.Length; i++)
        {
            fields1[i].SetValue(this, (float)fields2[i].GetValue(stats));
        }
    }
Exemple #23
0
        public Ship(string name, CombatStats combatStats, string iconName, float speed, float angularSpeed)
        {
            this.name        = name;
            this.combatStats = combatStats;

            this.iconName     = iconName;
            this.speed        = speed;
            this.angularSpeed = angularSpeed;
            SetTexture(iconName);
        }
Exemple #24
0
 private void MultipleFire(IEnemy enemy, CombatStats combatStats, IGunStatus status, int numClips)
 {
     for (int i = 0; i < numClips; i++)
     {
         while (status.HasShotLoaded())
         {
             status.Shoot(enemy, combatStats);
         }
         status.ReloadChamber();
     }
 }
Exemple #25
0
    public CombatStats CalculateDamage()
    {
        CombatStats damage = new CombatStats();

        ApplyCurse_TickDamage(ref damage, gearCurses);
        ApplyCurse_TickDamage(ref damage, activeCurses);
        ApplyCurse_InstantDamage(ref damage);
        ApplyCurse_TickDamage(ref damage, toggleCurses);

        return(damage);
    }
Exemple #26
0
    protected virtual void Awake()
    {
        if (floatingBarPrefab == null)
        {
            floatingBarPrefab = Resources.Load <GameObject>("Prefabs/UI/FloatingBars");
        }

        combatStats      = GetComponent <CombatStats>();
        spellMngr        = GetComponent <PlayerSpellManager>();
        playerController = GetComponent <PlayerController>();
    }
    public override void OnApplied(GameObject affectedTarget)
    {
        // Should probably check first if there is an effect of this type already.

        affectedTargetCombatStats = affectedTarget.gameObject.GetComponent <CombatStats>();
        affectedTargetCombatStats.MaxShield.Update();
        affectedTargetCombatStats.CurrentShield += Magnitude;

        // Move to EntityParticlesManager
        energyShieldFXInstance = MonoBehaviour.Instantiate(effectParticles, affectedTarget.transform.position + Vector3.up * 1f, affectedTarget.transform.rotation, affectedTarget.transform);
    }
Exemple #28
0
    static CombatStats _Multiply(float multiplier, CombatStats combatStats)
    {
        CombatStats result = new CombatStats();

        foreach (CombatStatEnum cse in System.Enum.GetValues(typeof(CombatStatEnum)))
        {
            result[cse] = multiplier * combatStats[cse];
        }

        return(result);
    }
Exemple #29
0
    public Stats MultiplyCombatStats(float multiplier)
    {
        CombatStats power = new CombatStats();

        foreach (CombatStatEnum cse in System.Enum.GetValues(typeof(CombatStatEnum)))
        {
            power[cse]      = this.power[cse] * multiplier;
            resistance[cse] = this.resistance[cse] * multiplier;
        }

        return(new Stats(aspectStats, power, resistance));
    }
Exemple #30
0
    public Character InitNewCharacter(string chatName, int ID, string role)
    {
        Character   c     = new Character();
        CombatStats stats = new CombatStats();

        c.ID       = ID;
        c.username = chatName;
        c.role     = role;
        c.prestige = 0;

        c.level = 1;
        c.stats = stats;

        c.isOnline      = true;
        c.damageDealt   = 0;
        c.gold          = 100;
        c.streamstone   = 1;
        c.experience    = 0;
        c.trainingTimer = 0f;
        c.isTraining    = false;
        c.antiSpamTimer = 0f;
        c.pvpDuel[0]    = "";
        c.pvpDuel[1]    = "0";
        c.pvpDuelTimer  = 0f;

        c.totalTrainingMinute = 0;
        c.pveVictory          = 0;
        c.pveDefeat           = 0;
        c.pvpVictory          = 0;
        c.pvpDefeat           = 0;
        c.legendaryCount      = 0;
        c.goldReceived        = 0;
        c.streamstoneReceived = 0;

        c.mainHandSlot[0]  = "Common";
        c.mainHandSlot[1]  = "1";
        c.mainHandSlot[2]  = "0";
        c.offHandSlot[0]   = "Common";
        c.offHandSlot[1]   = "1";
        c.offHandSlot[2]   = "0";
        c.headSlot[0]      = "Common";
        c.headSlot[1]      = "1";
        c.headSlot[2]      = "0";
        c.chestSlot[0]     = "Common";
        c.chestSlot[1]     = "1";
        c.chestSlot[2]     = "0";
        c.accessorySlot[0] = "Common";
        c.accessorySlot[1] = "1";
        c.accessorySlot[2] = "0";
        c.accessorySlot[3] = "Belt";

        return(c);
    }
Exemple #31
0
 //Function called when this character is created
 private void Awake()
 {
     //Setting the references to each of the required components
     this.charRaceTypes   = this.GetComponent <RaceTypes>();
     this.charInventory   = this.GetComponent <Inventory>();
     this.charSkills      = this.GetComponent <Skills>();
     this.charPhysState   = this.GetComponent <PhysicalState>();
     this.charCombatStats = this.GetComponent <CombatStats>();
     this.charActionList  = this.GetComponent <ActionList>();
     this.charSprites     = this.GetComponent <CharacterSprites>();
     this.charPerks       = this.GetComponent <PerkList>();
 }