public int getActionPoints(NewLogic logic) { int id = getID(); NewCharacterStatus player1 = logic.getStatusByPlayerID(1); NewCharacterStatus player2 = logic.getStatusByPlayerID(2); NewCharacterStatus target = player1.character.newSkillDic.ContainsKey("Skill" + id) && player1.character.newSkillDic["Skill" + id] == this ? player1 : null; if (target == null) { target = player2.character.newSkillDic.ContainsKey("Skill" + id) && player2.character.newSkillDic["Skill" + id] == this ? player2 : null; } if (target == null) { return(getActionPoints()); } else { return(Mathf.RoundToInt((float)target.getCurrentIndex("Skill" + id + "_aps"))); } }
public bool canCastSkill(NewLogic logic) { int id = getID(); NewCharacterStatus player1 = logic.getStatusByPlayerID(1); NewCharacterStatus player2 = logic.getStatusByPlayerID(2); NewCharacterStatus target = player1.character.newSkillDic.ContainsKey("Skill" + id) && player1.character.newSkillDic["Skill" + id] == this ? player1 : null; if (target == null) { target = player2.character.newSkillDic.ContainsKey("Skill" + id) && player2.character.newSkillDic["Skill" + id] == this ? player2 : null; } if (target == null) { return(true); } bool canAttack = target.canAttack(); return((getType() == SkillType.Buff && target.checkCondition(getCondition())) || (getType() == SkillType.Active && target.checkCondition(getCondition()) && canAttack)); }
public bool valueOfCondition(string condition) { NewCharacterStatus op_status = logic.getStatusByPlayerID(3 - owner.playerID); switch (condition) { case "": return(true); case Critical: return(false); case Melee: return(owner.character.characteristic.Type == Characteristic.CharacterType.MELE); case Ranger: return(owner.character.characteristic.Type == Characteristic.CharacterType.RANGER); case Be_Hit: case Hit: return(false); // khong the tinh toan chi co tat bat nen de mac dinh la false case Abnormal: return(valueOfCondition(Impotent) || valueOfCondition(Hypnotic) || valueOfCondition(Rot) || valueOfCondition(Pain) || valueOfCondition(Bleed) || valueOfCondition(Crazy) || valueOfCondition(Dull) || valueOfCondition(Stun) || valueOfCondition(Frostbite) || valueOfCondition(Burn) || valueOfCondition(Shock) || valueOfCondition(Poisoning) || valueOfCondition(Knockback) || valueOfCondition(Immobilization) || valueOfCondition(Blind) || valueOfCondition(Freezing) || valueOfCondition(Glamour) || valueOfCondition(Fear) || valueOfCondition(Disease) || valueOfCondition(Sleep) ); case Impotent: return(owner.op_effects.ContainsKey(NewEffect.Impotent)); case Hypnotic: return(owner.op_effects.ContainsKey(NewEffect.Hypnotic)); case Rot: return(owner.op_effects.ContainsKey(NewEffect.Rot)); case Pain: return(owner.op_effects.ContainsKey(NewEffect.Pain)); case Bleed: return(owner.op_effects.ContainsKey(NewEffect.Bleed)); case Crazy: return(owner.op_effects.ContainsKey(NewEffect.Crazy)); case Dull: return(owner.op_effects.ContainsKey(NewEffect.Dull)); case Stun: return(owner.op_effects.ContainsKey(NewEffect.Stun)); case Frostbite: return(owner.op_effects.ContainsKey(NewEffect.Frostbite)); case Burn: return(owner.op_effects.ContainsKey(NewEffect.Burn)); case Shock: return(owner.op_effects.ContainsKey(NewEffect.Shock)); case Poisoning: return(owner.op_effects.ContainsKey(NewEffect.Poisoning)); case Knockback: return(owner.op_effects.ContainsKey(NewEffect.Knockback)); case Immobilization: return(owner.op_effects.ContainsKey(NewEffect.Immobilization)); case Blind: return(owner.op_effects.ContainsKey(NewEffect.Blind)); case Freezing: return(owner.op_effects.ContainsKey(NewEffect.Freezing)); case Glamour: return(owner.op_effects.ContainsKey(NewEffect.Glamour)); case Fear: return(owner.op_effects.ContainsKey(NewEffect.Fear)); case Disease: return(owner.op_effects.ContainsKey(NewEffect.Disease)); case Sleep: return(owner.op_effects.ContainsKey(NewEffect.Sleep)); case E_Abnormal: return(valueOfCondition(E_Impotent) || valueOfCondition(E_Hypnotic) || valueOfCondition(E_Rot) || valueOfCondition(E_Pain) || valueOfCondition(E_Bleed) || valueOfCondition(E_Crazy) || valueOfCondition(E_Dull) || valueOfCondition(E_Stun) || valueOfCondition(E_Frostbite) || valueOfCondition(E_Burn) || valueOfCondition(E_Shock) || valueOfCondition(E_Poisoning) || valueOfCondition(E_Knockback) || valueOfCondition(E_Immobilization) || valueOfCondition(E_Blind) || valueOfCondition(E_Freezing) || valueOfCondition(E_Glamour) || valueOfCondition(E_Fear) || valueOfCondition(E_Disease) || valueOfCondition(E_Sleep) ); case E_Impotent: return(op_status.op_effects.ContainsKey(NewEffect.Impotent)); case E_Hypnotic: return(op_status.op_effects.ContainsKey(NewEffect.Hypnotic)); case E_Rot: return(op_status.op_effects.ContainsKey(NewEffect.Rot)); case E_Pain: return(op_status.op_effects.ContainsKey(NewEffect.Pain)); case E_Bleed: return(op_status.op_effects.ContainsKey(NewEffect.Bleed)); case E_Crazy: return(op_status.op_effects.ContainsKey(NewEffect.Crazy)); case E_Dull: return(op_status.op_effects.ContainsKey(NewEffect.Dull)); case E_Stun: return(op_status.op_effects.ContainsKey(NewEffect.Stun)); case E_Frostbite: return(op_status.op_effects.ContainsKey(NewEffect.Frostbite)); case E_Burn: return(op_status.op_effects.ContainsKey(NewEffect.Burn)); case E_Shock: return(op_status.op_effects.ContainsKey(NewEffect.Shock)); case E_Poisoning: return(op_status.op_effects.ContainsKey(NewEffect.Poisoning)); case E_Knockback: return(op_status.op_effects.ContainsKey(NewEffect.Knockback)); case E_Immobilization: return(op_status.op_effects.ContainsKey(NewEffect.Immobilization)); case E_Blind: return(op_status.op_effects.ContainsKey(NewEffect.Blind)); case E_Freezing: return(op_status.op_effects.ContainsKey(NewEffect.Freezing)); case E_Glamour: return(op_status.op_effects.ContainsKey(NewEffect.Glamour)); case E_Fear: return(op_status.op_effects.ContainsKey(NewEffect.Fear)); case E_Disease: return(op_status.op_effects.ContainsKey(NewEffect.Disease)); case E_Sleep: return(op_status.op_effects.ContainsKey(NewEffect.Sleep)); //case Hp_greater_10percent_maxhp: // return (float)owner.getCurrentIndex(Indexes.hp_na) > 0.1f * (float)owner.getCurrentIndex(Indexes.maX_hp_na); //case Hp_less_21percent_maxhp: //return (float)owner.getCurrentIndex(Indexes.hp_na) < 0.21f * (float)owner.getCurrentIndex(Indexes.maX_hp_na); case Shield_block_1_round: return(false); } return(calcuateLogicExpression(condition)); // dieu kien rong thi bao gio cung dung }