コード例 #1
0
    public static int GetExperienceSupport(InventoryTuple weapon, StatsContainer player)
    {
        int ld      = Mathf.Max(0, (int)(player.level * 0.5f) - 3);
        int baseExp = (weapon.weaponType == WeaponType.MEDKIT) ? 15 : 30;

        return(baseExp - ld);
    }
コード例 #2
0
    public void UpdateText(Selector selector)
    {
        selectorText.text = "";

        TileNode n    = selector.nodeSelected;
        string   temp = "X: " + selector.mapPosX + " Y: " + selector.mapPosY + "\n";

        temp += "Tile: " + selector.nodeSelected.type.TileName + "\n";

        foreach (string a in selector.nodeSelected.type.attributes)
        {
            temp += a + "\n";
        }

        StatsContainer sc = n.type.tileBonuses;

        temp += sc.PrintStats();



        foreach (TileEffect e in n.tileEffects)
        {
            temp += e.GetDescription() + "\n";
        }

        selectorText.text = temp;
    }
コード例 #3
0
ファイル: ActorData.cs プロジェクト: Tathomp/TacticsGame
    //public Flags ActorFlags { get; set; }

    public ActorData(string key) : base(key)
    {
        buffContainer     = new BuffContainer();
        isAlive           = true;
        equipment         = new Equipment();
        Relationships     = new Relationship();
        inventory         = new Inventory();
        toolbaar          = new ToolBarData();
        actorPropertyTags = new List <string>();
        // Relationships = new Relationship();

        blockAttack = false;
        blockMove   = false;

        JobDataState = new JobDataState();
        cooldownMap  = new CooldownMap();

        primaryJob     = "";
        secondaryJob   = "";
        description    = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae nunc eget leo maximus scelerisque commodo ut ex. Nulla iaculis dui erat, a pharetra ipsum pharetra a. Vestibulum sed commodo nisl, non feugiat nunc.";
        deathThreshold = 0;

        currentStatCollection = new StatsContainer();
        maxStatCollection     = new StatsContainer();
    }
コード例 #4
0
 /// <summary>
 /// Fills the entry with the data of the squad member.
 /// </summary>
 /// <param name="statsCon"></param>
 public void FillData(StatsContainer stats, int dataIndex)
 {
     icon.sprite    = stats.charData.portraitSet.small;
     entryName.text = stats.charData.entryName;
     level.text     = stats.level.ToString();
     index          = dataIndex;
 }
コード例 #5
0
 public void SelectCharacter()
 {
     if (popupMode)
     {
         levelupScript.Continue();
     }
     else if (!changeMode)
     {
         if (entryList.GetEntry().dark)
         {
             return;
         }
         changeMode   = true;
         selectedChar = playerData.stats[entryList.GetPosition()];
         CreateClassList();
         SetupCharacterInfo();
         SetupClassGains();
         changeView.SetActive(true);
         listView.SetActive(false);
     }
     else
     {
         StartCoroutine(ChangeClass());
     }
 }
コード例 #6
0
        private void MemoizeStats(StatsContainer stats)
        {
            Ensure.NotNull(stats, "stats");

            _memoizedStats        = stats;
            _lastStatsRequestTime = DateTime.UtcNow;
        }
コード例 #7
0
ファイル: StatBuff.cs プロジェクト: Tathomp/TacticsGame
    public StatBuff(StatContainerType containerType, bool reverseChange_on_removal)
    {
        this.containerType = containerType;
        sc_to_remove       = new StatsContainer();

        this.reverseChange_on_removal = reverseChange_on_removal;
    }
コード例 #8
0
    public void SetupStats(StatsContainer characterStats, bool levelup)
    {
        if (blackout != null)
        {
            blackout.SetActive(true);
        }
        levelupCongrats.SetActive(levelup);
        classChangeCongrats.SetActive(!levelup);
        levelupStats.SetActive(false);
        levelupArrow.SetActive(false);

        _level = characterStats.level;
        _hp    = characterStats.hp;
        _dmg   = characterStats.dmg;
        _mnd   = characterStats.mnd;
        _spd   = characterStats.spd;
        _skl   = characterStats.skl;
        _def   = characterStats.def;

        levelLevel.text = "";
        levelHp.text    = "";
        levelDmg.text   = "";
        levelMnd.text   = "";
        levelSpd.text   = "";
        levelSkl.text   = "";
        levelDef.text   = "";
    }
コード例 #9
0
    private IEnumerator ChangeClass()
    {
        lockControls.value = true;
        LevelGain level = gains[classList.GetPosition()];

        yield return(new WaitForSeconds(1f * currentGameSpeed.value));

        StatsContainer     stats     = playerData.stats[entryList.GetPosition()];
        InventoryContainer inventory = playerData.inventory[entryList.GetPosition()];
        SkillsContainer    skills    = playerData.skills[entryList.GetPosition()];

        levelupScript.SetupStats(stats, false);
        Debug.Log("CLASS CHANGE!");
        stats.ClassGain(level, (int)level.playerClassName);
        inventory.IncreaseWpnSkill(level.weaponSkills);
        skills.GainSkill(level.skill);

        sfxQueue.Enqueue(levelupFanfare);
        playSfxEvent.Invoke();
        popupMode = true;
        yield return(StartCoroutine(levelupScript.RunLevelup(stats)));

        popupMode = false;

        CreateListEntries();
        DeselectCharacter();
        lockControls.value = false;
        yield break;
    }
コード例 #10
0
    public void LoadData(StatsContainer cont)
    {
        id           = cont.id;
        statsID      = cont.statsID;
        level        = cont.level;
        currentExp   = cont.currentExp;
        currentSp    = cont.currentSp;
        weaponLevel  = cont.weaponLevel;
        supportLevel = cont.supportLevel;
        skillLevel   = cont.skillLevel;
        skillALevel  = cont.skillALevel;
        skillBLevel  = cont.skillBLevel;
        skillCLevel  = cont.skillCLevel;

        iHp  = cont.iHp;
        iAtk = cont.iAtk;
        iSpd = cont.iSpd;
        iDef = cont.iDef;
        iRes = cont.iRes;

        eHp  = cont.eHp;
        eAtk = cont.eAtk;
        eSpd = cont.eSpd;
        eDef = cont.eDef;
        eRes = cont.eRes;
    }
コード例 #11
0
    //  public bool excludeList;  //when true, jobs on list CAN'T use the item, when false, only jobs on the list can use the item


    public EquippableItem()
    {
        validSlots = new List <EquipmentSlot>();
        bonusStats = new StatsContainer();

        //excludeList = true;
    }
コード例 #12
0
        public void Handle(MonitoringMessage.GetFreshStats message)
        {
            try {
                StatsContainer stats;
                if (!TryGetMemoizedStats(out stats))
                {
                    stats = CollectStats();
                    if (stats != null)
                    {
                        _memoizedStats        = stats;
                        _lastStatsRequestTime = DateTime.UtcNow;
                    }
                }

                Dictionary <string, object> selectedStats = null;
                if (stats != null)
                {
                    selectedStats = stats.GetStats(message.UseGrouping, message.UseMetadata);
                    if (message.UseGrouping)
                    {
                        selectedStats = message.StatsSelector(selectedStats);
                    }
                }

                message.Envelope.ReplyWith(
                    new MonitoringMessage.GetFreshStatsCompleted(success: selectedStats != null, stats: selectedStats));
            } catch (Exception ex) {
                Log.ErrorException(ex, "Error on getting fresh stats");
            }
        }
コード例 #13
0
        /// <summary>
        /// Write the current round of stats to the log
        /// </summary>
        /// <param name="log">The logger to write to</param>
        public void WriteStatsToFile(ILogger log)
        {
            try {
                var statsContainer = new StatsContainer();
                statsContainer.Add(GetStats());
                var rawStats = statsContainer.GetStats(useGrouping: false, useMetadata: false);
                if (!_csv)
                {
                    rawStats.Add("timestamp", DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture));
                    log.Information("{@stats}", rawStats);
                }
                else
                {
                    var writeHeader = false;
                    var header      = StatsCsvEncoder.GetHeader(rawStats);
                    if (header != _lastWrittenCsvHeader)
                    {
                        _lastWrittenCsvHeader = header;
                        writeHeader           = true;
                    }

                    var line      = StatsCsvEncoder.GetLine(rawStats);
                    var timestamp = GetTimestamp(line);

                    if (writeHeader)
                    {
                        log.Information(Environment.NewLine);
                        log.Information(header);
                    }
                    log.Information(line);
                }
            } catch (Exception ex) {
                Log.Error(ex, "Error on regular stats collection.");
            }
        }
コード例 #14
0
        private void CollectRegularStats()
        {
            try {
                var stats = CollectStats();
                if (stats != null)
                {
                    var rawStats = stats.GetStats(useGrouping: false, useMetadata: false);

                    if ((_statsStorage & StatsStorage.File) != 0)
                    {
                        SaveStatsToFile(LogManager.StructuredLog ? StatsContainer.Group(rawStats) : rawStats);
                    }

                    if ((_statsStorage & StatsStorage.Stream) != 0)
                    {
                        if (_statsStreamCreated)
                        {
                            SaveStatsToStream(rawStats);
                        }
                    }
                }
            } catch (Exception ex) {
                Log.ErrorException(ex, "Error on regular stats collection.");
            }
        }
コード例 #15
0
 /// <summary>
 /// Fills the entry with the data of the character.
 /// </summary>
 /// <param name="statsCon"></param>
 public void FillData(StatsContainer stats, InventoryContainer inv)
 {
     icon.sprite    = stats.charData.portraitSet.small;
     entryName.text = stats.charData.entryName;
     invCon         = inv;
     UpdateRestock();
 }
コード例 #16
0
    // gibt was es nicht ins Inv rein tun konnte als int zurück
    public float Increment(Element _element, float _amount, bool _isGive)
    {
        float returnVal, delta;

        returnVal = Max - (Count() + _amount);
        if (returnVal > 0)
        {
            returnVal = 0;
        }
        delta = _amount + returnVal;

        if (inventorySlots.Find(e => e.elementKey == _element.Key) != null)
        {
            inventorySlots.Find(e => e.elementKey == _element.Key).currentSlotCapacity += delta;
        }
        else
        {
            inventorySlots.Add(new InventorySlots()
            {
                element = _element, currentSlotCapacity = delta, isGive = _isGive
            });
        }

        StatsContainer.UpdateStat("ELEMENT_AMOUNT", _element.Key, "RAISE", delta);
        return(returnVal);
    }
コード例 #17
0
 public override void Start()
 {
     base.Start();
     stats = new StatsContainer(FinalStat(assingStr), FinalStat(assingCharm),
                                FinalStat(assingDex), FinalStat(assingEnd), FinalStat(assingInt), assingWill);
     body = new Body(FinalHeight, FinalFat, FinalMuscle);
     startRaces.ForEach(r => RaceSystem.AddRace(r.Races, r.Amount));
     startGender.Assing(this);
     if (NeedFirstName)
     {
         if (GenderType == GenderTypes.Masculine)
         {
             Identity.FirstName = RandomName.MaleName;
         }
         else
         {
             Identity.FirstName = RandomName.FemaleName;
         }
     }
     if (NeedLastName)
     {
         Identity.LastName = RandomName.LastName;
     }
     InitHealth();
 }
コード例 #18
0
    private void ShowHealForecast(TacticsMove lefter, TacticsMove righter, int heal)
    {
        StatsContainer stats     = lefter.stats;
        int            currentHp = lefter.currentHealth;

        fullBackground.SetActive(true);
        attackBackground.SetActive(false);
        playerNormalObject.SetActive(false);
        playerForecastObject.SetActive(true);

        characterName.text = stats.charName;
        portrait.enabled   = true;
        portrait.sprite    = stats.portrait;
        typeIcon.enabled   = true;
        typeIcon.color     = (lefter.GetWeapon() != null) ? lefter.GetWeapon().GetTypeColor() : Color.white;
        hpText.text        = currentHp + " -> " + currentHp;
        damageTextObj.SetActive(false);
        advIcon.enabled      = false;
        extraSkillName.text  = (stats.GetSkill() != null) ? stats.GetSkill().skillName : "";
        extraSkillValue.text = (stats.GetSkill() != null) ? Mathf.Max(0, stats.GetSkill().maxCharge - lefter.skillCharge).ToString() : "";
        extraSkillObject.gameObject.SetActive(true);
        playerStatsObject.SetActive(true);

        stats               = righter.stats;
        currentHp           = righter.currentHealth;
        eCharacterName.text = stats.charName;
        ePortrait.enabled   = true;
        ePortrait.sprite    = stats.portrait;
        eTypeIcon.enabled   = true;
        eTypeIcon.color     = (righter.GetWeapon() != null) ? righter.GetWeapon().GetTypeColor() : Color.white;
        eHpText.text        = currentHp + " -> " + Mathf.Min(currentHp + heal, stats.hp);
        eDamageTextObj.SetActive(false);
        eAdvIcon.enabled = false;
        targetStatsObject.SetActive(true);
    }
コード例 #19
0
    /// <summary>
    /// Shows a basic overview of the character with some stats and combat stats.
    /// </summary>
    /// <param name="tactics"></param>
    private void ShowBasicStats(TacticsMove tactics)
    {
        if (tactics == null)
        {
            return;
        }
        StatsContainer  stats  = tactics.stats;
        SkillsContainer skills = tactics.skills;

        menuView.SetActive(true);
        statsObject.SetActive(false);
        basicObject.SetActive(true);
        inventoryObject.SetActive(false);

        //		colorBackground.color = (tactics.faction == Faction.PLAYER) ?
        //			new Color(0.2f,0.2f,0.5f) : new Color(0.5f,0.2f,0.2f);

        characterName.text = stats.charData.entryName;
        portrait.enabled   = true;
        portrait.sprite    = stats.charData.portraitSet.small;
        levelClass.text    = string.Format("Level {0}  {1}", stats.level, stats.currentClass.entryName);
        healthBar.SetAmount(tactics.currentHealth, tactics.stats.hp);
        expBar.SetAmount(tactics.stats.currentExp, 100);
        expBar.gameObject.SetActive(tactics.faction == Faction.PLAYER);
        weakIcon1.sprite  = weaknessIcons.icons[(int)stats.currentClass.classType];
        weakIcon1.enabled = (weakIcon1.sprite != null);

        InventoryTuple weapon = tactics.GetEquippedWeapon(ItemCategory.WEAPON);

        wpnIcon.sprite  = weapon?.icon;
        wpnIcon.enabled = (weapon != null);
        wpnName.text    = (weapon != null) ? weapon.entryName : "---";

        for (int i = 0; i < skillImages.Length; i++)
        {
            if (i >= skills.skills.Length || skills.skills[i] == null)
            {
                skillImages[i].sprite = noSkillImage;
            }
            else
            {
                skillImages[i].sprite = skills.skills[i].icon;
            }
        }

        int pwer = BattleCalc.CalculateDamage(weapon, stats);

        pwrText.text = (pwer != -1) ? "Pwr:  " + pwer : "Pwr:  --";
        int hitrate = BattleCalc.GetHitRate(weapon, stats);

        hitText.text   = (hitrate != -1) ? "Hit:  " + hitrate : "Hit:  --";
        avoidText.text = "Avo:  " + (BattleCalc.GetAvoid(stats) + tactics.currentTile.terrain.avoid);
        for (int i = 0; i < fatigueLevels.Length; i++)
        {
            fatigueLevels[i].SetActive(i == tactics.stats.fatigueAmount);
        }

        //Terrain
        boostAvoid.enabled = (tactics.currentTile.terrain.avoid > 0);
    }
コード例 #20
0
ファイル: TextControl.cs プロジェクト: cwaidelich/Handel
    // Update is called once per frame
    void Update()
    {
//		InformationBar.text = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
        InformationBar.text  = "H: " + StatsContainer.GetValueF("ELEMENT_AMOUNT", 1);
        InformationBar.text += ", H*: " + StatsContainer.GetValueF("ELEMENT_AMOUNT", 3);
        InformationBar.text += ", Speed: " + Time.timeScale.ToString();
    }
コード例 #21
0
ファイル: ForecastUI.cs プロジェクト: parrexion/Fried-Embrum
    private void ShowHealForecast(TacticsMove healer, TacticsMove receiver, InventoryTuple staff)
    {
        StatsContainer stats = healer.stats;

        colorBackground.color  = (healer.faction == Faction.PLAYER) ? new Color(0.7f, 0.7f, 1f) : new Color(1f, 0.7f, 0.7f);
        eColorBackground.color = (receiver.faction == Faction.PLAYER) ? new Color(0.7f, 0.7f, 1f) : new Color(1f, 0.7f, 0.7f);
        hCharacterName.text    = stats.charData.entryName;
        hPortrait.sprite       = stats.charData.portraitSet.small;

        stats = receiver.stats;
        hCharacterName2.text = stats.charData.entryName;
        hPortrait2.sprite    = stats.charData.portraitSet.small;
        if (inBattle)
        {
            hHpBar.SetAmount(healer.currentHealth, healer.stats.hp);
            hHpBar2.SetAmount(receiver.currentHealth, receiver.stats.hp);
        }

        hWpnIcon.sprite = staff.icon;
        hWpnName.text   = staff.entryName;

        if (!inBattle)
        {
            hWpnCharge.text = (string.IsNullOrEmpty(staff.uuid)) ? staff.currentCharges.ToString() : "";
            hHealText.text  = string.Format("{0} → {1} ({2})",
                                            _defenderTactics.currentHealth,
                                            Mathf.Min(_defenderTactics.currentHealth + BattleCalc.CalculateHeals(staff, _attackerTactics.stats), _defenderTactics.stats.hp),
                                            _defenderTactics.stats.hp);
        }
    }
コード例 #22
0
    public IEnumerator AwardExp()
    {
        if (runningExp)
        {
            yield break;
        }

        runningExp         = true;
        lockControls.value = true;
        totalScrap.value  -= awardAmount;
        StatsContainer stats = playerData.stats[entryList.GetPosition()];

        expMeter.gameObject.SetActive(true);
        expMeter.currentExp = stats.currentExp;
        Debug.Log("Exp is currently: " + stats.currentExp);
        yield return(new WaitForSeconds(0.5f * currentGameSpeed.value));

        sfxQueue.Enqueue(levelupFill);
        playSfxEvent.Invoke();

        int convertedExp = 10 * awardAmount;

        awardAmount = 0;
        while (convertedExp > 0)
        {
            convertedExp--;
            expMeter.currentExp++;
            if (expMeter.currentExp == 100)
            {
                expMeter.currentExp = 0;
                stopSfxEvent.Invoke();
                yield return(new WaitForSeconds(1f * currentGameSpeed.value));

                expMeter.gameObject.SetActive(false);
                levelupScript.SetupStats(stats, true);
                Debug.Log("LEVELUP!");
                stats.GainLevel();
                sfxQueue.Enqueue(levelupFanfare);
                playSfxEvent.Invoke();
                yield return(StartCoroutine(levelupScript.RunLevelup(stats)));

                expMeter.gameObject.SetActive(true);
                sfxQueue.Enqueue(levelupFill);
                playSfxEvent.Invoke();
            }
            yield return(null);
        }
        stopSfxEvent.Invoke();
        yield return(new WaitForSeconds(0.5f * currentGameSpeed.value));

        expMeter.gameObject.SetActive(false);
        stats.currentExp = expMeter.currentExp;

        entryList.GetEntry().FillData(stats);
        SetupBexpAwarding();
        SetupCharacterInfo();
        lockControls.value = false;
        runningExp         = false;
    }
コード例 #23
0
    public static StatsContainer AddSC(StatsContainer sc1, StatsContainer sc2)
    {
        StatsContainer temp = (StatsContainer)sc1.Copy();

        temp.AddStats(sc2);

        return(temp);
    }
コード例 #24
0
ファイル: StatEditPrefab.cs プロジェクト: Tathomp/TacticsGame
    public void InitConatinerPanel(StatsContainer sc, StatTypes stat)
    {
        this.sc   = sc;
        this.type = stat;

        statLabel.text = stat.ToString();
        input.text     = sc.GetValue(stat) + "";
    }
コード例 #25
0
 /// <summary>
 /// Critical hit rate for the character with the given weapon.
 /// </summary>
 /// <param name="weaponAtk"></param>
 /// <param name="attacker"></param>
 /// <returns></returns>
 public static int GetCritRate(InventoryTuple weaponAtk, StatsContainer attacker)
 {
     if (weaponAtk == null)
     {
         return(-1);
     }
     return(weaponAtk.critRate + attacker.critBoost - attacker.fatigueAmount * 2);
 }
コード例 #26
0
ファイル: Slime.cs プロジェクト: EnginyeriaSofwareUB/ES2017F2
    public float GetDamageReduction()
    {
        StatsContainer core            = player.statsCoreInfo;
        float          currentRatio    = massRatio;
        float          damageReduction = (currentRatio * (maxDamageReduction - minDamageReduction) + minDamageReduction);

        return(1 - damageReduction);
    }
コード例 #27
0
 /// <summary>
 /// Fills the entry with the data of the character.
 /// </summary>
 /// <param name="statsCon"></param>
 public void FillData(StatsContainer stats)
 {
     icon.sprite       = stats.charData.portraitSet.small;
     entryName.text    = stats.charData.entryName;
     level.text        = stats.level.ToString();
     exp.text          = stats.currentExp.ToString();
     currentClass.text = stats.currentClass.entryName;
 }
コード例 #28
0
 public RawPlayer(int id, int actions, StatsContainer stats, float actionsPerSlime)
 {
     this.id              = id;
     this.turnActions     = actions;
     this.statsCoreInfo   = stats;
     this.actionsPerSlime = actionsPerSlime;
     this.conqueredTiles  = new List <TileData>();
 }
コード例 #29
0
ファイル: Slime.cs プロジェクト: EnginyeriaSofwareUB/ES2017F2
    public void changeScaleSlime()
    {
        float          scale;
        StatsContainer core = player.statsCoreInfo;

        scale = massRatio * (maxScale - minScale) + minScale;
        this.gameObject.transform.localScale = new Vector3(scale, scale, 0.5f);
    }
コード例 #30
0
 public static int CalculateHeals(InventoryTuple weaponAtk, StatsContainer attacker)
 {
     if (weaponAtk == null)
     {
         return(-1);
     }
     return(weaponAtk.power + attacker.skl);
 }