private void doDamageCalModifier(Units target, AttrType type, ref float damage) { if (type != AttrType.Hp) { if (type == AttrType.Mp) { if (damage + target.mp >= target.mp_max) { damage = target.mp_max - target.mp; } if (damage + target.mp <= 0f) { damage = -target.mp; } } } else { if (damage + target.hp >= target.hp_max) { damage = target.hp_max - target.hp; } if (damage + target.hp <= 0f) { damage = -target.hp; } } }
public static void MulAttr(this RoleData target, AttrType attrType, float value) { switch (attrType) { case AttrType.WalkSpeed: target.WalkSpeed *= value; break; case AttrType.HpMax: target.HpMax *= value; break; case AttrType.MpMax: target.MpMax *= value; break; case AttrType.Atk: target.Atk *= value; break; case AttrType.Hp: target.Hp *= value; break; case AttrType.Mp: target.Mp *= value; break; case AttrType.Tili: target.Tili *= value; break; case AttrType.Def: target.Def *= value; break; case AttrType.AtkSpeedScale: target.AtkSpeedScale *= value; break; case AttrType.MoveSpeedScale: target.MoveSpeedScale *= value; break; case AttrType.CriticalRate: target.CriticalRate *= value; break; case AttrType.CriticalDamage: target.CriticalDamage *= value; break; case AttrType.TiliMax: target.TiliMax *= value; break; default: break; } }
public static string GetAttriDetailValueStr(HeroDetailedAttr data, AttrType type) { string result = string.Empty; if (data != null && BattleEquipTools_config.dicAttriDetailShowInfo.ContainsKey(type)) { BattleEquipTools_config.AttriDetailInfo attriDetailInfo = BattleEquipTools_config.dicAttriDetailShowInfo[type]; Type type2 = data.GetType(); FieldInfo field = type2.GetField(attriDetailInfo._baseValue); float num = (float)field.GetValue(data); FieldInfo field2 = type2.GetField(attriDetailInfo._extraValue); float num2 = (float)field2.GetValue(data); result = string.Concat(new string[] { attriDetailInfo._attriName, ":", (num + num2).ToString(attriDetailInfo._format), "(", attriDetailInfo._extraColor, "+", num2.ToString(attriDetailInfo._format), "[-])" }); } return(result); }
private void ParseEnemyInfo() { TextAsset enemyinfo = Resources.Load <TextAsset>("Json/EnemyInfo"); JSONObject j = new JSONObject(enemyinfo.text); foreach (JSONObject temp in j.list) { int id = (int)temp["id"].n; string name = temp["name"].str; string animation = temp["animation"].str; int gold = (int)temp["gold"].n; int exp = (int)temp["exp"].n; JSONObject j2 = temp["attr"]; List <ApplyAttrEffect> applyAttrEffects = new List <ApplyAttrEffect>(); foreach (JSONObject temp2 in j2.list) { AttrType attrType = (AttrType)System.Enum.Parse(typeof(AttrType), temp2["attrtype"].str); int value = (int)temp2["value"].n; ApplyAttrEffect applyAttrEffect = new ApplyAttrEffect(attrType, value); applyAttrEffects.Add(applyAttrEffect); } Enemy enemy = new Enemy(id, name, animation, gold, exp, applyAttrEffects); enemiesList.Add(enemy); } }
public void OnAttrChanged(AttrType type, float oldValue, float newValue) { if (null != AttrFloatChangedDelegate) { AttrFloatChangedDelegate(type, oldValue, newValue); } }
private String getNodeAttrValue(XmlNode node, AttrType atr) { string type = null; switch (atr) { case AttrType.Id: type = "id"; break; case AttrType.Source: type = "source"; break; case AttrType.SourceType: type = "sourceType"; break; case AttrType.Target: type = "target"; break; case AttrType.TargetType: type = "targetType"; break; case AttrType.Title: type = "title"; break; case AttrType.Type: type = "type"; break; case AttrType.Value: type = "value"; break; } if (String.IsNullOrEmpty(type)) { return(null); } return(node.Attributes[type].Value); }
public void OnAttrChanged(AttrType type, int oldValue, int newValue) { if (null != AttrIntChangedDelegate) { AttrIntChangedDelegate(type, oldValue, newValue); } }
private void CompleteNature(ref Dictionary <AttrType, float> change, Dictionary <AttrType, float> target, bool isAdd) { if (target == null || target.Count == 0) { return; } foreach (KeyValuePair <AttrType, float> current in target) { if (!change.ContainsKey(current.Key)) { change[current.Key] = 0f; } if (isAdd) { Dictionary <AttrType, float> dictionary; Dictionary <AttrType, float> expr_54 = dictionary = change; AttrType key; AttrType expr_5D = key = current.Key; float num = dictionary[key]; expr_54[expr_5D] = num + current.Value; } else { Dictionary <AttrType, float> dictionary2; Dictionary <AttrType, float> expr_7E = dictionary2 = change; AttrType key; AttrType expr_88 = key = current.Key; float num = dictionary2[key]; expr_7E[expr_88] = num - current.Value; } } }
public void WhenAttrChange(Attr Attr, AttrType AttrChange, float Value) { if (OnCharAttrEventArgs != null) { OnCharAttrEventArgs(this, new CharAttrEventArgs(GetState, Attr, AttrChange, Value)); } }
public void OnAttrChange(AttrType type, int value) { if (state == StateType.Die || state == StateType.Rescued) { return; } if (Disappearing) { return; } if (type == AttrType.ATTR_HP) { hp += value; if (hp < 0) { hp = 0; } } if (IsDie()) { ChangeDie(DamageType.Buffer); } }
private static void processAttributes(Node node, IList idrefs, ResultBuffer rs, EvaluationContext context) { if (!node.hasAttributes()) { return; } NamedNodeMap attributeList = node.Attributes; for (int atsub = 0; atsub < attributeList.Length; atsub++) { Attr atNode = (Attr)attributeList.item(atsub); NodeType atType = new AttrType(atNode, context.StaticContext.TypeModel); if (atType.ID) { if (hasIDREF(idrefs, atNode)) { if (!isDuplicate(node, rs)) { ElementType element = new ElementType((Element)node, context.StaticContext.TypeModel); rs.add(element); } } } } }
protected override Formula <T> GetFormula <T>(AttrType type) { switch (type) { case AttrType.Exp: return(mExp as Formula <T>); case AttrType.MoveSpeed: return(mMoveSpeed as Formula <T>); case AttrType.Hp: return(mHp as Formula <T>); case AttrType.HpLmt: return(mHpLmt as Formula <T>); case AttrType.Atk: return(mAtk as Formula <T>); case AttrType.Defence: return(mDefence as Formula <T>); } return(base.GetFormula <T>(type)); }
public float GetAttrByType(GameObject gameObject, AttrType attrType) { CharacetStatus status = gameObject.GetComponent <CharacetStatus>(); if (attrType == AttrType.STR) { return(status.STR); } if (attrType == AttrType.AGI) { return(status.AGI); } else if (attrType == AttrType.MAG) { return(status.MAG); } else if (attrType == AttrType.VIT) { return(status.VIT); } if (attrType == AttrType.AttackRate) { return(status.AttackRate); } else if (attrType == AttrType.HPRemain) { return(status.HP_Remain); } else { Debug.LogError("没有对应属性的类型"); return(0); } }
public static float GetDifficultyLevelAwardMulAttr(this RoleData target, AttrType attrType) { float value = 0; int add = (target.difficultyLevel - 1).Range(0, 9999999); switch (attrType) { case AttrType.HpMax: value = 1 + add * 0.2f; break; case AttrType.Atk: value = 1 + add * 0.1f; break; case AttrType.Def: value = 1 + add * 0.05f; break; default: value = 1; break; } return(value); }
public void OnAttrChanged(AttrType type, long oldValue, long newValue) { if (null != AttrLongChangedDelegate) { AttrLongChangedDelegate(type, oldValue, newValue); } }
public static float GetLevelAwardAttr(this RoleData target, AttrType attrType) { float value = 0; int add = (target.level - 1).Range(0, 9999999); switch (attrType) { case AttrType.HpMax: value = add * 25; break; case AttrType.Atk: value = add * 5; break; case AttrType.Def: value = add * 3; break; default: value = 0; break; } return(value); }
//获取属性 public int GetAttr(AttrType attrType) { int value = 0; AttrDic.TryGetValue(attrType, out value); return(value); }
private float CalL2ByL1(AttrType type) { switch (type) { case AttrType.Attack: if (this.MainAttrType == AttrType.Power || this.MainAttrType == AttrType.Agile || this.MainAttrType == AttrType.Intelligence) { return(this.GetAttr(DataManager.DataPoolType.CurrentData, this.MainAttrType) * 1f); } return(0f); case AttrType.Armor: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Agile)); case AttrType.AttackSpeed: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Agile) * 0.01f); case AttrType.HpMax: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Power) * 20f); case AttrType.MpMax: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Intelligence) * 10f); case AttrType.HpRestore: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Power) * this.GetData <float>(DataType.HpRestoreParam)); case AttrType.MpRestore: return(this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.Intelligence) * this.GetData <float>(DataType.MpRestoreParam)); } return(0f); }
public static void AddAttr(this RoleDbInfo self, AttrType t, string v) { self.AttrStrs.Add(new AttrStr() { K = (int)t, V = v }); }
public static void AddAttr(this RoleDbInfo self, AttrType t, long v) { self.AttrInts.Add(new AttrInt() { K = (int)t, V = v }); }
protected float CalAttrByType(AttrType type) { float attr = this.GetAttr(DataManager.DataPoolType.BasicData, type); float growthByAttr = this.GetGrowthByAttr(type); float num = this.CalL2ByL1(type); float attr2 = this.GetAttr(DataManager.DataPoolType.AddData, type); float attr3 = this.GetAttr(DataManager.DataPoolType.MulData, type); float attr4 = this.GetAttr(DataManager.DataPoolType.AddDataBefore, type); float attr5 = this.GetAttr(DataManager.DataPoolType.MulDataBefore, type); float value; if (type == AttrType.Shield) { value = attr + growthByAttr + num + attr2 + this.GetAttr(DataManager.DataPoolType.CurrentData, AttrType.HpMax) * (attr3 + attr5) + attr4; value = Mathf.Clamp(value, 0f, 3.40282347E+38f); } else if (type == AttrType.AttackSpeed) { value = (attr + growthByAttr + attr2) * (1f + attr3 + num + attr5) + attr4; } else { value = (attr + growthByAttr + num + attr2) * (1f + attr3 + attr5) + attr4; } return(this.SetAttr(type, value)); }
protected void CalcAllAttrs() { this.CalAttrByType(AttrType.Power); this.CalAttrByType(AttrType.Agile); this.CalAttrByType(AttrType.Intelligence); IEnumerator enumerator = Enum.GetValues(typeof(AttrType)).GetEnumerator(); try { while (enumerator.MoveNext()) { AttrType attrType = (AttrType)((int)enumerator.Current); if (attrType != AttrType.None && attrType != AttrType.End && attrType != AttrType.Hp && attrType != AttrType.Mp) { this.CalAttrByType(attrType); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
protected float SetAttr(AttrType attrType, float value) { switch (attrType) { case AttrType.Hp: value = Mathf.Clamp(value, 0f, this.GetAttr(AttrType.HpMax)); return(this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value)); case AttrType.Mp: value = Mathf.Clamp(value, 0f, this.GetAttr(AttrType.MpMax)); return(this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value)); case AttrType.Power: this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value); return(value); case AttrType.Agile: this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value); return(value); case AttrType.Intelligence: this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value); return(value); case AttrType.HpMax: { float attr = this.GetAttr(AttrType.HpMax); float attr2 = this.GetAttr(AttrType.Hp); if (attr == 0f) { this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.HpMax, value); this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.Hp, value); } else { this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.HpMax, value); this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.Hp, attr2 * (value / attr)); } return(value); } case AttrType.MpMax: { float attr3 = this.GetAttr(AttrType.MpMax); float attr4 = this.GetAttr(AttrType.Mp); if (attr3 == 0f) { this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.MpMax, value); this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.Mp, value); } else { this.SetAttr(DataManager.DataPoolType.CurrentData, AttrType.MpMax, value); } return(value); } } return(this.SetAttr(DataManager.DataPoolType.CurrentData, attrType, value)); }
public AttrEntity(AttrType type, string name, string value, string focusNode1 = null, string focusNode2 = null) { this.name = name; this.value = value; this.focusNode1 = focusNode1; this.focusNode2 = focusNode2; this.type = type; }
public static string GetDesc(AttrType type, long value, string hyphen, string typeColor, string valueColor, bool isHyphenAccordWithType) { if (isHyphenAccordWithType) { return(string.Format("{0}{1}", TextColorMgr.GetColor(string.Format("{0}{1}", AttrUtility.GetAttrName(type), hyphen), typeColor, string.Empty), TextColorMgr.GetColor(AttrUtility.GetAttrValueDisplay(type, value), valueColor, string.Empty))); } return(string.Format("{0}{1}", TextColorMgr.GetColor(AttrUtility.GetAttrName(type), typeColor, string.Empty), TextColorMgr.GetColor(string.Format("{0}{1}", hyphen, AttrUtility.GetAttrValueDisplay(type, value)), valueColor, string.Empty))); }
public static float GetArmorAttr(this RoleData target, AttrType attrType) { if (target.EquipData != null && target.EquipData.armorData != null && string.IsNullOrWhiteSpace(target.EquipData.armorData.id) == false) { return(target.EquipData.armorData.GetAttr(attrType)); } return(0); }
public static float GetAttr(this EquipData target, AttrType attrType) { if (target != null && target.attrData != null) { return(target.attrData.GetAttr(attrType)); } return(0); }
public void doDataChangeAction(AttrType type, float value, Units casterUnit, bool isReverse = false) { if (value != 0f) { this.self.ChangeAttr(type, OpType.Add, value); this.self.jumpFontValue(type, value, null, false, false, 0, 0); } }
/// <summary> /// 获取指定类型的属性值 /// </summary> public static float GetAttr(float[] attrs, AttrType attrType) { if ((int)attrType < attrs.Length) { return(attrs[(int)attrType]); } return(0); }
public static float GetOffHandFinalAttr(this RoleData target, AttrType attrType) { if (target.EquipData != null && target.EquipData.MainHand != null && string.IsNullOrWhiteSpace(target.EquipData.MainHand.id) == false) { return(target.GetFinalAttr(attrType) - target.EquipData.MainHand.GetAttr(attrType)); } return(target.GetFinalAttr(attrType)); }
public Event(PhysicalObject target_,int delay_,AttrType attr_,int value_) { target=target_; delay=delay_; type=EventType.REMOVE_ATTR; attr=attr_; value=value_; msg=""; msg_objs = null; time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
public Event(PhysicalObject target_,int delay_,AttrType attr_) { //todo: try removing some of these constructors. maybe FINALLY do Event.Create() and/or Event.RemoveAttr(...), Event.Move(...). that might work. target=target_; delay=delay_; type=EventType.REMOVE_ATTR; attr=attr_; value=1; msg=""; msg_objs = null; time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
public void KillEvents(PhysicalObject target,AttrType attr) { for(LinkedListNode<Event> current = list.First;current!=null;current = current.Next){ current.Value.Kill(target,attr); } }
public Event FindAttrEvent(PhysicalObject target,AttrType attr) { for(LinkedListNode<Event> current = list.First;current!=null;current = current.Next){ if(!current.Value.dead && current.Value.target == target && current.Value.type == EventType.REMOVE_ATTR && current.Value.attr == attr){ return current.Value; } } return null; }
/*public Event(int delay_,string msg_,params PhysicalObject[] objs){ target=null; delay=delay_; type=EventType.ANY_EVENT; attr=AttrType.NO_ATTR; value=0; msg=msg_; msg_objs = new List<PhysicalObject>(); foreach(PhysicalObject obj in objs){ msg_objs.Add(obj); } time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }*/ public Event(List<Tile> area_,int delay_,EventType type_) { target=null; /*area = new List<Tile>(); //todo: reverted this. hope it works. foreach(Tile t in area_){ area.Add(t); }*/ area=area_; delay=delay_; type=type_; attr=AttrType.NO_ATTR; value=0; msg=""; msg_objs = null; time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
public void GainAttrRefreshDuration(AttrType attr, int duration) { Q.KillEvents(this, attr); attrs[attr]++; Q.Add(new Event(this, duration, attr, attrs[attr])); }
private bool MentalEffect(AttrType attr) { switch(attr){ case AttrType.STUNNED: case AttrType.CONFUSED: //case AttrType.MAGICAL_DROWSINESS: case AttrType.ASLEEP: case AttrType.ENRAGED: return true; default: return false; } }
public bool HasAttr(AttrType attr) { return attrs[attr] > 0; }
public Attribute(Color color) { this.color = color; this.type = AttrType.Normal; }
public void GainAttrRefreshDuration(AttrType attr,int duration,string msg,params PhysicalObject[] objs) { attrs[attr]++; Event e = Q.FindAttrEvent(this,attr); if(e != null){ if(e.TimeToExecute() < duration + Q.turn){ //if the new one would last longer than the old one, replace it. e.dead = true; Q.Add(new Event(this,duration,attr,attrs[attr],msg,objs)); } else{ //(if the old one still lasts longer, update it so it removes the new value) e.value = attrs[attr]; } } else{ Q.Add(new Event(this,duration,attr,attrs[attr],msg,objs)); } }
public void GainAttr(AttrType attr, int duration, int value, string msg) { attrs[attr] += value; Q.Add(new Event(this, duration, attr, value, msg)); }
private static void Define(ActorType type_, string name_, string symbol_, Color color_, int maxhp_, int speed_, int level_, int light_radius_, AttrType[] attrlist) { proto[type_] = new Actor(type_, name_, symbol_, color_, maxhp_, speed_, level_, light_radius_, attrlist); }
public void GainAttr(AttrType attr, int duration, int value, string msg, PhysicalObject[] objs) { attrs[attr] += value; Q.Add(new Event(this, duration, attr, value, msg, objs)); }
public Actor(ActorType type_, string name_, string symbol_, Color color_, int maxhp_, int speed_, int level_, int light_radius_, AttrType[] attrlist) { atype = type_; SetName(name_); symbol = symbol_; color = color_; maxhp = maxhp_; curhp = maxhp; speed = speed_; level = level_; light_radius = light_radius_; target = null; inv = null; target_location = null; time_of_last_action = 0; recover_time = 0; player_visibility_duration = 0; weapons.Insert(0, WeaponType.NO_WEAPON); armors.Insert(0, ArmorType.NO_ARMOR); F = new SpellType[13]; for (int i = 0; i < 13; ++i) { F[i] = SpellType.NO_SPELL; } magic_penalty = 0; for (int i = 0; i < attrlist.Length; i++)//) { attrs[attrlist[i]]++; }//row and col are -1 }
/*public Event(List<Tile> area_,int delay_,EventType type_,string msg_,params PhysicalObject[] objs){ target=null; area=area_; delay=delay_; type=type_; attr=AttrType.NO_ATTR; value=0; msg=msg_; msg_objs = new List<PhysicalObject>(); foreach(PhysicalObject obj in objs){ msg_objs.Add(obj); } time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }*/ public Event(PhysicalObject target_,List<Tile> area_,int delay_,EventType type_) { target=target_; area=area_; delay=delay_; type=type_; attr=AttrType.NO_ATTR; value=0; msg=""; msg_objs = null; time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
public void ApplyStatus(AttrType attr,int duration) { ApplyStatus(attr,duration,"","",""); }
public Event(PhysicalObject target_,List<Tile> area_,int delay_,EventType type_,AttrType attr_,FeatureType feature_,int value_,string msg_,params PhysicalObject[] objs) { target=target_; area=area_; delay=delay_; type=type_; attr=attr_; feature = feature_; value=value_; msg=msg_; msg_objs = new List<PhysicalObject>(); foreach(PhysicalObject obj in objs){ msg_objs.Add(obj); } time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
private static bool IsMsgConformAttribute(IMsg msg, AttrType attrType) { switch (attrType) { case AttrType.Any: return true; case AttrType.Unread: return msg.IsUnread; case AttrType.Marked: return msg.Marked; case AttrType.UnreadAnswerToMe: return msg.IsUnread && msg.Parent.UserID > 0 && msg.Parent.UserID == Config.Instance.SelfId; } return false; }
public void GainAttr(AttrType attr,int duration,string msg,params PhysicalObject[] objs) { attrs[attr]++; Q.Add(new Event(this,duration,attr,msg,objs)); }
public void GainAttr(AttrType attr, int duration) { attrs[attr]++; Q.Add(new Event(this, duration, attr)); }
public Attribute(Color color, AttrType type) { this.color = color; this.type = type; }
public void ApplyStatus(AttrType attr,int duration,bool use_default_messages,string message,string expiration_message,string resisted_message) { string[] strings = GetMessagesForStatus(attr); if(use_default_messages){ if(message == ""){ message = strings[0]; } if(expiration_message == ""){ expiration_message = strings[1]; } if(resisted_message == ""){ resisted_message = strings[2]; } } if(HasAttr(AttrType.MENTAL_IMMUNITY) && MentalEffect(attr)){ //no message for now } else{ if(R.PercentChance(TotalSkill(SkillType.SPIRIT)*8)){ if(!(HasAttr(attr) && NoMessageOnRefresh(attr))){ B.Add(resisted_message,this); } } else{ if(!(HasAttr(attr) && NoMessageOnRefresh(attr))){ B.Add(message,this); } RefreshDuration(attr,duration,expiration_message,this); if(this == player){ switch(attr){ case AttrType.CONFUSED: Help.TutorialTip(TutorialTopic.Confusion); break; case AttrType.STUNNED: Help.TutorialTip(TutorialTopic.Stunned); break; case AttrType.VULNERABLE: Help.TutorialTip(TutorialTopic.Vulnerable); break; case AttrType.SILENCED: Help.TutorialTip(TutorialTopic.Silenced); break; } } } } }
private String getNodeAttrValue(XmlNode node, AttrType atr) { string type = null; switch (atr) { case AttrType.Id: type = "id"; break; case AttrType.Source: type = "source"; break; case AttrType.SourceType: type = "sourceType"; break; case AttrType.Target: type = "target"; break; case AttrType.TargetType: type = "targetType"; break; case AttrType.Title: type = "title"; break; case AttrType.Type: type = "type"; break; case AttrType.Value: type = "value"; break; } if (String.IsNullOrEmpty(type)) return null; return node.Attributes[type].Value; }
public void ApplyStatus(AttrType attr,int duration,string message,string expiration_message,string resisted_message) { ApplyStatus(attr,duration,true,message,expiration_message,resisted_message); }
public void SelectNodeByAttribute(StepDirection dir, AttrType attrType, SearchMessageArea area) { var activeNode = (IMsg)_tgMsgs.ActiveNode; if (activeNode == null) return; var topic = activeNode.Topic; // Ищем в текущей ветке. var treeNodes = dir == StepDirection.Down ? TreeGrid.TreeGrid.GetFlatArrayOfSubNodes(topic, activeNode) : TreeGrid.TreeGrid.GetFlatArrayOfSubNodesReverse(topic, activeNode); foreach (IMsg msg in treeNodes) if (IsMsgConformAttribute(msg, attrType)) { _tgMsgs.ActiveNode = msg; return; } // Если не нашли, то ищем темы (кроневые ветки) имеющие ответы. var isCurrPassed = false; var messages = new Msg[_tgMsgs.Nodes.Count]; _tgMsgs.Nodes.CopyTo(messages, 0); if (dir == StepDirection.Up) Array.Reverse(messages); foreach (IMsg msg in messages) { // Пропускаем все ветки пока не найдем текущую тему. if (!isCurrPassed && msg != topic) continue; if (!isCurrPassed) { isCurrPassed = true; continue; // Текущую тему тоже нужно пропустить. } // если топик сменился, а нас просили искать только в текущем топике - выходим if (area == SearchMessageArea.CurrentTopic && msg.TopicID != topic.TopicID) break; // Если в тему есть var isFound = false; switch (attrType) { case AttrType.Any: isFound = true; break; case AttrType.Marked: isFound = msg.RepliesMarked > 0 || msg.Marked; break; case AttrType.Unread: isFound = msg.RepliesUnread > 0 || msg.IsUnread; break; case AttrType.UnreadAnswerToMe: isFound = msg.RepliesToMeUnread > 0; break; } if (isFound) { switch (attrType) { case AttrType.Any: break; case AttrType.Marked: isFound = msg.IsMarked; break; case AttrType.Unread: isFound = msg.IsUnread; break; default: isFound = false; break; } if (isFound) { _tgMsgs.ActiveNode = msg; return; } treeNodes = TreeGrid.TreeGrid.GetFlatArrayOfSubNodes(msg); if (dir == StepDirection.Up) Array.Reverse(treeNodes); foreach (IMsg subMsg in treeNodes) if (IsMsgConformAttribute(subMsg, attrType)) { _tgMsgs.ActiveNode = subMsg; return; } throw new ApplicationException( "Аргрегированная информация не соответсвует реальному содержанию БД. Произведите " + "пересчет БД и обратитесь к разработчикам."); } } Beeper.DoBeep(); return; }
public Event(PhysicalObject target_,int delay_,AttrType attr_,int value_,string msg_,params PhysicalObject[] objs) { target=target_; delay=delay_; type=EventType.REMOVE_ATTR; attr=attr_; value=value_; msg=msg_; msg_objs = new List<PhysicalObject>(); foreach(PhysicalObject obj in objs){ msg_objs.Add(obj); } time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
private bool NoMessageOnRefresh(AttrType attr) { //todo: most gases go here switch(attr){ case AttrType.POISONED: //case AttrType.MAGICAL_DROWSINESS: //todo: vulnerable too, or not? case AttrType.SILENCED: case AttrType.BLIND: //perhaps I need separate lists for monsters and the player case AttrType.CONFUSED: case AttrType.ASLEEP: return true; default: return false; } }
public Event(int delay_,EventType type_) { target=null; delay=delay_; type=type_; attr=AttrType.NO_ATTR; value=0; msg=""; msg_objs = null; time_created=Q.turn; dead=false; tiebreaker = Q.Tiebreaker; }
public void Kill(PhysicalObject target_,AttrType attr_) { if(target == target_ && type == EventType.REMOVE_ATTR && attr == attr_){ target = null; if(msg_objs != null){ msg_objs.Clear(); msg_objs = null; } if(area != null){ area.Clear(); area = null; } dead = true; } }
public void GainAttrRefreshDuration(AttrType attr, int duration, string msg, params PhysicalObject[] objs) { Q.KillEvents(this, attr); attrs[attr]++; Q.Add(new Event(this, duration, attr, attrs[attr], msg, objs)); }