Esempio n. 1
0
    public void ShowHitBuff(Army army, BuffClass buff, int type)
    {
        if (GameConst.CanShowText() == false)
        {
            return;
        }
        string temp = "";

        switch (type)
        {
        case 0:
            temp = "\t\t" + "<color=" + GameConst.Color.redColor + "【" + army.name + "】</color>的" + "<color=" + GameConst.Color.yellowColor +
                   buff.effectName + "</color>" + "效果无法施加,存在一个相同或更强的效果";
            break;

        case 1:
            temp = "\t\t" + "<color=" + GameConst.Color.redColor + "【" + army.name + "】</color>的" + "<color=" + GameConst.Color.yellowColor +
                   buff.effectName + "</color>" + "效果已施加 (来自 " + buff.skill.name + " )";
            break;

        case 2:
            temp = "\t\t" + "<color=" + GameConst.Color.redColor + "【" + army.name + "】</color>的" + "<color=" + GameConst.Color.yellowColor +
                   buff.effectName + "</color>" + "效果被刷新了! (来自 " + buff.skill.name + " )";
            break;

        case 3:

            break;
        }



        Append(temp);
    }
Esempio n. 2
0
        public void AddReducedStat(Stats bonusType, ushort stat, BuffClass statGroup)
        {
            if (bonusType < Stats.MaxStatCount)
            {
                GetUnitStat(bonusType).AddReducedStat(stat, (byte)statGroup);
            }

            if (bonusType == Stats.Wounds || bonusType == Stats.Armor || bonusType == Stats.Willpower || bonusType == Stats.WeaponSkill || bonusType == Stats.Initiative || bonusType == Stats.Strength || bonusType == Stats.Toughness || bonusType == Stats.BallisticSkill)
            {
                ApplyStats();
            }

            switch (bonusType)
            {
            case Stats.ArmorPenetration:
                int ArmPen = (int)((Player)_Owner).StsInterface.GetTotalStat(Stats.ArmorPenetration);
                if (_Owner.Loaded && _Owner.IsPlayer())
                {
                    ArmPen -= stat;
                }
                break;

            case Stats.MaxActionPoints:
                if (_Owner.Loaded && _Owner.IsPlayer())
                {
                    ((Player)_Owner).MaxActionPoints -= stat;
                }
                break;
            }
        }
Esempio n. 3
0
    public BuffClass Clone()
    {
        BuffClass tmp = new BuffClass();

        tmp.Type = Type;
        tmp.Time = Time;
        return(tmp);
    }
Esempio n. 4
0
    public void AddBuff(BuffClass buff)
    {
        if (buff == null)
        {
            MyTools.ppp("加进来就是空的");
        }

        buffList.Add(buff);
    }
        /// <summary>
        /// Gets the buff class considering potential buff command override.
        /// </summary>
        /// <param name="command">Command to apply.</param>
        /// <returns>Buff class</returns>
        public BuffClass GetBuffClass(BuffCommandInfo command)
        {
            BuffClass clazz = command.BuffClass;

            if (clazz != BuffClass.Standard)
            {
                return(clazz);
            }
            return(_buffInfo.BuffClass);
        }
Esempio n. 6
0
    public void AddBuff(BuffClass buff)
    {
        Buff buf = new Buff();

        buf.buffClass     = buff;
        buf.timeTotal     = 0;
        buf.timeRemain    = 1;
        buf.buffDisplayer = GameObject.Find("BuffList").GetComponent <BuffList>().GetBuffDisplayer(buf);

        playerBuffList.Add(buf);
    }
Esempio n. 7
0
        public void AddReducedMultiplier(Stats bonusType, float mult, BuffClass statGroup)
        {
            if (bonusType < Stats.MaxStatCount)
            {
                GetUnitStat(bonusType).AddReductionMultiplier(mult, (byte)statGroup);
            }

            if (bonusType == Stats.Wounds || bonusType == Stats.Armor || bonusType == Stats.Willpower || bonusType == Stats.WeaponSkill || bonusType == Stats.Initiative || bonusType == Stats.Strength || bonusType == Stats.Toughness || bonusType == Stats.BallisticSkill)
            {
                ApplyStats();
            }
        }
Esempio n. 8
0
 public void RemoveBuff(BuffClass targetClass)
 {
     for (int i = 0; i < playerBuffList.Count; i++)
     {
         if (playerBuffList[i].buffClass == targetClass)
         {
             playerBuffList[i].Destroy();
             playerBuffList.Remove(playerBuffList[i]);
             i--;
         }
     }
 }
Esempio n. 9
0
    public bool HasBuff(BuffClass targetClass)
    {
        foreach (Buff buf in playerBuffList)
        {
            if (buf.buffClass == targetClass)
            {
                return(true);
            }
        }

        return(false);
    }
Esempio n. 10
0
        public void RemoveReducedMultiplier(Stats bonusType, float mult, BuffClass statGroup)
        {
            byte type = (byte)bonusType;

            if (bonusType < Stats.MaxStatCount)
            {
                _statModifiers[type].RemoveReductionMultiplier(mult, (byte)statGroup);
            }
            if (bonusType == Stats.Wounds || bonusType == Stats.Armor || bonusType == Stats.Willpower || bonusType == Stats.WeaponSkill || bonusType == Stats.Initiative || bonusType == Stats.Strength || bonusType == Stats.Toughness || bonusType == Stats.BallisticSkill)
            {
                ApplyStats();
            }
        }
Esempio n. 11
0
    public string Action(List <Army> enemyList)
    {
        //轮到本部队行动


        List <BuffClass> removeList = new List <BuffClass>();

        //首先结算自身的BUFF
        for (int i = 0; i < buffQueue.Count; i++)
        {
            BuffClass temp = buffQueue[i];

            //MyTools.ppp(temp.effectName);

            if (temp.DoEffect(this) == false)
            {
                removeList.Add(temp);//标记删除
            }
        }

        for (int i = removeList.Count - 1; i >= 0; i--)
        {
            var tempBuff = removeList[i];
            MyTools.ins.ShowRemoveBuff(this, tempBuff);
            buffQueue.Remove(tempBuff);
            tempBuff = null;
        }
        removeList.Clear();


        //然后判断自身是否可以行动,死没晕没

        //然后按照顺序触发主动技能
        CastAllSkill(skillList, enemyList);

        //然后进行普攻
        //暂时忽略攻击距离
        //  int tempIndex = (int)MyTools.ins.getRandom(0, enemyList.Count-1);
        //   Attack(enemyList[tempIndex]);


        //然后触发追击技能


        return(null);
    }
Esempio n. 12
0
    public void ShowRemoveBuff(Army army, BuffClass buff)
    {
        if (GameConst.CanShowText() == false)
        {
            return;
        }

        string temp = "";

        switch (buff.buffType)
        {
        case BuffType.DOT:

            temp = "" + "<color=" + GameConst.Color.redColor + "【" + army.name + "】 </color>的来自" + "<color=" + GameConst.Color.greenColor + buff.skill.army.name + "</color>【" + buff.skill.name + "】的" + buff.effectName + "效果消失了";
            break;
        }

        Append(temp);
    }
Esempio n. 13
0
        public void RemoveBonusStat(Stats bonusType, ushort stat, BuffClass statGroup)
        {
            if (bonusType < Stats.MaxStatCount)
            {
                _statModifiers[(byte)bonusType].RemoveBonusStat(stat, (byte)statGroup);
            }

            if (bonusType == Stats.Willpower || bonusType == Stats.WeaponSkill || bonusType == Stats.Initiative || bonusType == Stats.Strength || bonusType == Stats.Toughness || bonusType == Stats.BallisticSkill)
            {
                ApplyStats();
            }

            switch (bonusType)
            {
            case Stats.Wounds:
            case Stats.Armor:
                ApplyStats();
                break;

            case Stats.Mastery1Bonus:
            case Stats.Mastery2Bonus:
            case Stats.Mastery3Bonus:
                if (_Owner.Loaded && _Owner.IsPlayer())
                {
                    Player p = (_Owner as Player);
                    if (p != null && p.AbtInterface.Loaded)
                    {
                        p.AbtInterface.RefreshBonusMasteryPoints();
                    }
                }
                break;

            // RB   4/17/2016   Added support for adjusting max AP pool
            case Stats.MaxActionPoints:
                if (_Owner.Loaded && _Owner.IsPlayer())
                {
                    Player p = (_Owner as Player);
                    p.MaxActionPoints -= stat;
                }
                break;
            }
        }
Esempio n. 14
0
    //中buff
    public void HitBuff(BuffClass buff)
    {
        var tempBuff = buffQueue.Find(n => n.effectName.Equals(buff.effectName));

        if (tempBuff != null)
        {
            //找到一个相同效果的BUFF,然后来判断替换规则

            switch (buff.switchRule)
            {
            case SwitchRule.NOT:

                break;

            case SwitchRule.RESET:
                tempBuff.ResetRound();
                break;

            case SwitchRule.SWITCH:

                if (buff.switchWeight > tempBuff.switchWeight)
                {
                    buffQueue.Remove(tempBuff);
                    buffQueue.Add(buff);
                    MyTools.ins.ShowHitBuff(this, buff, 2);
                }
                else
                {
                    //存在一个更强大的BUFF
                    MyTools.ins.ShowHitBuff(this, buff, 0);
                }
                break;
            }
        }
        else
        {
            //未找到则直接追加
            buffQueue.Add(buff);
            MyTools.ins.ShowHitBuff(this, buff, 1);
        }
    }
    public override void PerformAction()
    {
        EntityAlive myEntity = null;

        if (OwnerQuest.OwnerJournal.OwnerPlayer != null)
        {
            myEntity = OwnerQuest.OwnerJournal.OwnerPlayer as EntityAlive;
        }

        if (myEntity != null)
        {
            myEntity.PlayOneShot(base.ID, true);
            BuffClass buff = BuffManager.GetBuff(base.Value);
            if (buff != null)
            {
                if (!myEntity.Buffs.HasBuff(base.Value))
                {
                    myEntity.Buffs.AddBuff(base.Value);
                }
            }
        }
    }
Esempio n. 16
0
        public static void LoadXml()
        {
            if (!Utils.FileExists(filePath))
            {
                UpdateXml();
            }
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(filePath);
            }
            catch (XmlException e)
            {
                Log.Error(string.Format("[SERVERTOOLS] Failed loading {0}: {1}", file, e.Message));
                return;
            }
            XmlNode _XmlNode = xmlDoc.DocumentElement;

            foreach (XmlNode childNode in _XmlNode.ChildNodes)
            {
                if (childNode.Name == "Prayers")
                {
                    Dict.Clear();
                    foreach (XmlNode subChild in childNode.ChildNodes)
                    {
                        if (subChild.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }
                        if (subChild.NodeType != XmlNodeType.Element)
                        {
                            Log.Warning(string.Format("[SERVERTOOLS] Unexpected XML node found in 'Prayers' section: {0}", subChild.OuterXml));
                            continue;
                        }
                        XmlElement _line = (XmlElement)subChild;
                        if (!_line.HasAttribute("Name"))
                        {
                            Log.Warning(string.Format("[SERVERTOOLS] Ignoring Prayer entry because of missing Name attribute: {0}", subChild.OuterXml));
                            continue;
                        }
                        if (!_line.HasAttribute("Message"))
                        {
                            Log.Warning(string.Format("[SERVERTOOLS] Ignoring Prayer entry because of missing Message attribute: {0}", subChild.OuterXml));
                            continue;
                        }
                        string    _buff    = _line.GetAttribute("Name");
                        string    _message = _line.GetAttribute("Message");
                        BuffClass _class   = BuffManager.GetBuff(_buff);
                        if (_class == null)
                        {
                            Log.Warning(string.Format("[SERVERTOOLS] Ignoring Prayer entry because buff was not valid: {0}", subChild.OuterXml));
                            continue;
                        }
                        if (!Dict.ContainsKey(_buff))
                        {
                            Dict.Add(_buff, _message);
                        }
                    }
                }
            }
        }
Esempio n. 17
0
 public static void LoadXml()
 {
     try
     {
         if (!File.Exists(FilePath))
         {
             UpdateXml();
         }
         XmlDocument xmlDoc = new XmlDocument();
         try
         {
             xmlDoc.Load(FilePath);
         }
         catch (XmlException e)
         {
             Log.Error(string.Format("[SERVERTOOLS] Failed loading {0}: {1}", file, e.Message));
             return;
         }
         bool        upgrade    = true;
         XmlNodeList childNodes = xmlDoc.DocumentElement.ChildNodes;
         if (childNodes != null)
         {
             Dict.Clear();
             for (int i = 0; i < childNodes.Count; i++)
             {
                 if (childNodes[i].NodeType != XmlNodeType.Comment)
                 {
                     XmlElement line = (XmlElement)childNodes[i];
                     if (line.HasAttributes)
                     {
                         if (line.HasAttribute("Version") && line.GetAttribute("Version") == Config.Version)
                         {
                             upgrade = false;
                             continue;
                         }
                         else if (line.HasAttribute("Name") && line.HasAttribute("Message"))
                         {
                             string    buff    = line.GetAttribute("Name");
                             string    message = line.GetAttribute("Message");
                             BuffClass _class  = BuffManager.GetBuff(buff);
                             if (_class == null)
                             {
                                 Log.Warning(string.Format("[SERVERTOOLS] Ignoring Prayer.xml entry. Buff is not valid: {0}", line.OuterXml));
                                 continue;
                             }
                             if (!Dict.ContainsKey(buff))
                             {
                                 Dict.Add(buff, message);
                             }
                         }
                     }
                 }
             }
         }
         if (upgrade)
         {
             XmlNodeList nodeList = xmlDoc.DocumentElement.ChildNodes;
             XmlNode     node     = nodeList[0];
             XmlElement  line     = (XmlElement)nodeList[0];
             if (line != null)
             {
                 if (line.HasAttributes)
                 {
                     OldNodeList = nodeList;
                     File.Delete(FilePath);
                     UpgradeXml();
                     return;
                 }
                 else
                 {
                     nodeList = node.ChildNodes;
                     line     = (XmlElement)nodeList[0];
                     if (line != null)
                     {
                         if (line.HasAttributes)
                         {
                             OldNodeList = nodeList;
                             File.Delete(FilePath);
                             UpgradeXml();
                             return;
                         }
                     }
                     File.Delete(FilePath);
                     UpdateXml();
                     Log.Out(string.Format("[SERVERTOOLS] The existing Prayer.xml was too old or misconfigured. File deleted and rebuilt for version {0}", Config.Version));
                 }
             }
         }
     }
     catch (Exception e)
     {
         if (e.Message == "Specified cast is not valid.")
         {
             File.Delete(FilePath);
             UpdateXml();
         }
         else
         {
             Log.Out(string.Format("[SERVERTOOLS] Error in Prayer.LoadXml: {0}", e.Message));
         }
     }
 }
Esempio n. 18
0
	public BuffClass(BuffClass buf){ skillId = buf.skillId; liveTime = buf.liveTime; imageId = buf.imageId;}