コード例 #1
0
        static public string SI_ShieldUp(object info)
        {
            Multitype <NetCard, NetSkill, NetBattlefield> data = info as Multitype <NetCard, NetSkill, NetBattlefield>;

            if (data != null)
            {
                var  ns    = data.t1;
                var  bf    = data.t2;
                FInt value = ns.GetFloatAttribute("TAG-CA_SHIELD");
                if (value == FInt.ZERO)
                {
                    if (bf.ChallengeType == EChallengeType.TypePhysical)
                    {
                        value = ns.GetFloatAttribute("TAG-SHIELDING_PHYSICAL");
                    }
                    else if (bf.ChallengeType == EChallengeType.TypeMental)
                    {
                        value = ns.GetFloatAttribute("TAG-SHIELDING_MENTAL");
                    }
                    else if (bf.ChallengeType == EChallengeType.TypeMental)
                    {
                        value = ns.GetFloatAttribute("TAG-SHIELDING_SPIRIT");
                    }
                }

                return(value.ToInt().ToString());
            }

            Multitype <SkillInstance, Subskill, ClientEntityCharacter> dInfo = info as Multitype <SkillInstance, Subskill, ClientEntityCharacter>;
            SkillInstance         si        = dInfo.t0;
            Subskill              ss        = dInfo.t1;
            ClientEntityCharacter character = dInfo.t2;
            var dataInWorld = si.GetCurrentSkillAttributes()[ss];

            if (dataInWorld.attributes != null && dataInWorld.attributes.Count > 0)
            {
                string st    = null;
                FInt   value = dataInWorld.GetFInt("TAG-CA_SHIELD");
                if (value == FInt.ZERO)
                {
                    return(value.ToString());
                }

                foreach (var v in ss.challengeTypes)
                {
                    switch (v)
                    {
                    case EChallengeType.TypePhysical:
                        value = dataInWorld.GetFInt("TAG-SHIELDING_PHYSICAL");
                        break;

                    case EChallengeType.TypeMental:
                        value = dataInWorld.GetFInt("TAG-SHIELDING_MENTAL");
                        break;

                    case EChallengeType.TypeSpirit:
                        value = dataInWorld.GetFInt("TAG-SHIELDING_SPIRIT");
                        break;
                    }

                    if (st == null)
                    {
                        st = "";
                    }
                    else
                    {
                        st += "|";
                    }

                    st += value;
                }
                return(st != null ?  st : "");
            }

            return("");
        }
コード例 #2
0
        static public string SI_ProceduralDamage(object info)
        {
            Multitype <NetCard, NetSkill, NetBattlefield> data = info as Multitype <NetCard, NetSkill, NetBattlefield>;

            if (data != null)
            {
                return(GameplayUtils.GetDamageFor(data.t1, data.t0).ToString(false));
            }

            Multitype <SkillInstance, Subskill, ClientEntityCharacter> dInfo = info as Multitype <SkillInstance, Subskill, ClientEntityCharacter>;
            SkillInstance         si        = dInfo.t0;
            Subskill              ss        = dInfo.t1;
            ClientEntityCharacter character = dInfo.t2;

            var skillAttributes = si.GetCurrentSkillAttributes()[ss];
            int flags           = skillAttributes.GetFInt("ProceduralFlags").ToInt();

            string st = null;

            FInt  dmgBase = GameplayUtils.GetDamageFor(si, ss, null);
            float addBase = (flags & (int)EActivatorBlocks.Additive) > 0 ?  GameplayUtils.DamageNormalToAdditive(dmgBase) : 0f;

            var a = new FInt(addBase);

            if (ss.challengeTypes == null || character == null)
            {
                if (addBase > 0)
                {
                    st = "x" + dmgBase.ToString(true) + " [+" + a.ToString(true) + "]";
                }
                else
                {
                    st = "x" + dmgBase.ToString(true);
                }
            }
            else
            {
                foreach (var v in ss.challengeTypes)
                {
                    string color = "";
                    switch (v)
                    {
                    case EChallengeType.TypePhysical:
                        color = "XML_COLOR-PHYSICAL";
                        break;

                    case EChallengeType.TypeMental:
                        color = "XML_COLOR-MENTAL";
                        break;

                    case EChallengeType.TypeSpirit:
                        color = "XML_COLOR-SPIRITUAL";
                        break;
                    }

                    if (st == null)
                    {
                        st = "";
                    }
                    else
                    {
                        st += "|";
                    }

                    if (addBase > 0)
                    {
                        st += "x" + dmgBase.ToString(true) + "[+" + a.ToString(true) + "]" +
                              " ( " +
                              ColorUtils.GetColorAsTextTag(color) +
                              GameplayUtils.GetDamageFor(si, ss, character, v, true).ToString(false) +
                              ColorUtils.GetColorAsTextTag("XML_COLOR-NORMAL_FONT") +
                              " )";
                    }
                    else
                    {
                        st += "x" + dmgBase.ToString(true) +
                              " ( " +
                              ColorUtils.GetColorAsTextTag(color) +
                              GameplayUtils.GetDamageFor(si, ss, character, v).ToString(false) +
                              ColorUtils.GetColorAsTextTag("XML_COLOR-NORMAL_FONT") +
                              " )";
                    }
                }
            }
            return(st);
        }
コード例 #3
0
ファイル: FInt.cs プロジェクト: d00mlord/SwordGame
 // Return random FInt within a range. Includes both end points.
 public static FInt RandomRange(System.Random seed, FInt min, FInt max)
 {
     if (min > max)
     {
         Debug.LogError("Min must be less than max. Min: " + min.ToString() + ", Max: " + max.ToString());
         return 0L;
     }
     FInt r = new FInt((long)seed.Next());
     FInt diff = max - min;
     return (r * diff) / new FInt(2147483648L) + min;
 }