public static void LegendaryRollingSpeed_Uninstall() { MoveSkill rollAbility = PlayerInfo.GetPlayer().GetComponent <AbilityManager>().GetRollAbility() as MoveSkill; rollAbility.onEndCast -= RollingSpeed; effectValueL4 = 0; }
/// <summary> /// 好戦的な移動を行います /// </summary> /// <returns>移動量</returns> /// <param name="useSkill">使用するスキル</param> private int advance(MoveSkill useSkill) { //エリア危険性レベルを取得 Dictionary <FieldPosition, int> areaDangerLevelTable = BattleManager.getInstance().getAreaDangerLevelTableInRange(user, useSkill.getMove(user)); var keys = areaDangerLevelTable.Keys; int sumDangerLevel = 0; foreach (FieldPosition pos in keys) { sumDangerLevel += areaDangerLevelTable[pos]; } //最終判定:レベルが高いところへ int rand = UnityEngine.Random.Range(0, sumDangerLevel) + 1; foreach (FieldPosition pos in keys) { if (areaDangerLevelTable[pos] >= rand) { FieldPosition nowPos = BattleManager.getInstance().searchCharacter(user); int move = pos - nowPos; return(move); } else { rand -= areaDangerLevelTable[pos]; } } throw new InvalidOperationException("cannot dicide advance move"); }
public static void LegendaryRollStaminaReduction_Uninstall() { MoveSkill rollAbility = PlayerInfo.GetPlayer().GetComponent <AbilityManager>().GetRollAbility() as MoveSkill; rollAbility.alterStamina -= RollStaminaReduction; effectValueL2 = 0; }
protected override void addInstance(string[] datas) { var skill = new MoveSkill(datas); dataTable.Add(skill); SkillBookDataManager.getInstance().setData(skill); }
public virtual bool CheckSkills(Mobile m) { if (m.Skills[MoveSkill].Value < RequiredSkill) { string args = $"{RequiredSkill.ToString("F1")}\t{MoveSkill.ToString()}\t "; m.SendLocalizedMessage(1063013, args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. return(false); } return(true); }
/// <summary> /// 移動系スキルの移動量を決定します /// </summary> /// <returns>移動量</returns> /// <param name="useSkill">使用するスキル</param> public int decideMove(MoveSkill useSkill) { //HPが最大HPの50%以下なら非戦的行動、以上なら好戦的行動 if ((user.getHp() / user.getMaxHp()) * 100 <= 50) { return(recession(useSkill)); } else { return(advance(useSkill)); } }
public static List <Node> GetAvilableNeighbor(/*Model.Unit agent,*/ MoveSkill moveSkill, Node center) { List <Node> neighbor = new List <Node>(); List <Vector2Int> positions = moveSkill.GetAvlPositions(center.unitPosition); foreach (Vector2Int position in positions) { // Debug.Log(center.unitPosition + "?? " + position); neighbor.Add(new Node(position, center)); } return(neighbor); }
/// <summary> /// BattleTaskを生成します /// </summary> /// <returns>生成したタスク</returns> private BattleTask creatTask() { if (!isReady) { throw new InvalidOperationException("manager hasn't readied yet"); } IActiveSkill skill = ai.decideSkill(); if (ActiveSkillSupporter.isAffectSkill(skill)) { Extent extent = ActiveSkillSupporter.searchExtent(skill); BattleTask returnTask; //効果範囲に応じてタスクを生成 switch (extent) { case Extent.SINGLE: IBattleable target = ai.decideSingleTarget(skill); List <IBattleable> singleTargetList = new List <IBattleable>() { target }; returnTask = new BattleTask(user.getUniqueId(), skill, singleTargetList, battletaskIdCount); break; case Extent.AREA: FieldPosition pos = ai.decideAreaTarget(skill); returnTask = new BattleTask(user.getUniqueId(), skill, pos, battletaskIdCount); break; case Extent.ALL: List <IBattleable> allTargetList = BattleManager.getInstance().getJoinedBattleCharacter(); returnTask = new BattleTask(user.getUniqueId(), skill, allTargetList, battletaskIdCount); break; default: throw new NotSupportedException("unkonwn extent"); } battletaskIdCount++; return(returnTask); } else if (skill.getActiveSkillType() == ActiveSkillType.MOVE) { MoveSkill moveSkill = (MoveSkill)skill; int move = ai.decideMove(moveSkill); BattleTask returnTask = new BattleTask(user.getUniqueId(), skill, move, battletaskIdCount); battletaskIdCount++; return(returnTask); } throw new InvalidOperationException("unknown skillType"); }
//--- L3 End --- // --- L4 Start public static void LegendaryRollingSpeed_Install(float value) { MoveSkill rollAbility = PlayerInfo.GetPlayer().GetComponent <AbilityManager>().GetRollAbility() as MoveSkill; rollAbility.onEndCast -= RollingSpeed; rollAbility.onEndCast += RollingSpeed; if (effectValueL4 == 0) { effectValueL4 = value; } else { effectValueL4 = Mathf.Max(effectValueL4, value); } }
//--- L1 End --- //--- L2 Start public static void LegendaryRollStaminaReduction_Install(float value) { MoveSkill rollAbility = PlayerInfo.GetPlayer().GetComponent <AbilityManager>().GetRollAbility() as MoveSkill; rollAbility.alterStamina -= RollStaminaReduction; rollAbility.alterStamina += RollStaminaReduction; value /= 100f; if (effectValueL2 == 0) { effectValueL2 = (int)value; } else { effectValueL2 = Mathf.Max(effectValueL2, (int)value); } }
/// <summary> /// 非好戦的な移動を行います /// </summary> /// <returns>移動量</returns> /// <param name="useSkill">使用するスキル</param> private int recession(MoveSkill useSkill) { Debug.Log("reacession"); //エリア危険性レベルを取得 Dictionary <FieldPosition, int> areaDangerLevelTable = BattleManager.getInstance().getAreaDangerLevelTableInRange(user, useSkill.getMove(user)); Dictionary <int, int> dangerLevelIntegerTable = new Dictionary <int, int>(); var keys = areaDangerLevelTable.Keys; int sumDangerLevel = 0; foreach (FieldPosition pos in keys) { sumDangerLevel += areaDangerLevelTable[pos]; dangerLevelIntegerTable.Add((int)pos, areaDangerLevelTable[pos]); } //最終判定:レベルが低いところへ FieldPosition nowPos = BattleManager.getInstance().searchCharacter(user); int move = MathHelper.getRandomKeyLowerOrderProbality(dangerLevelIntegerTable) - (int)nowPos; //move = move = BattleManager.getInstance().restructionPositionValue(nowPos, move); return(move); }
IEnumerator Vuoronhoito(Character aktiivinen){ //siivottava vuoro = false; ISkill skill = new MoveSkill(); //aktiivinen.ChooseSkill (); //valitaan taito, jonka hahmo tekee //while (skill==null) { // skill=aktiivinen.GetSkill(); // yield break; // } Character kohde=null; //valitaan kohde, pitää muokata jos taito kohdistaa kaveria/eiketään while(kohde==null){ foreach (Character hahmo in tappelijat) { if ( hahmo.tag!=aktiivinen.tag&&hahmo.valittu){ kohde=hahmo; break; } } yield return null; } if (skill.Do (aktiivinen, kohde)) { StartCoroutine(aktiivinen.Move(kohde.transform.position)); } i++; //seuraava hahmo if (i == tappelijat.Count) { i = 0; } while (!aktiivinen.valmis) { yield return null; } foreach (Character hahmo in tappelijat) { hahmo.valittu=false; hahmo.valmis=false; } vuoro = true; yield return null; }
/// <summary> /// 스킬을 사용한 길찾기 알고리즘 /// </summary> /// <param name="agent">길을 찾을 유닛</param> /// <param name="moveSkill">유닛이 사용할 이동스킬</param> /// <param name="from">시작위치</param> /// <param name="to">목적지</param> /// <returns></returns> public static List <Vector2Int> PathFindAlgorithm(/*Model.Unit agent,*/ MoveSkill moveSkill, Vector2Int from, Vector2Int to) { if (FieldManager.GetTile(to) == null || FieldManager.GetTile(to).HasUnit()) { // Debug.LogWarning("길찾기 알고리즘 오류"); return(null); } Node node = new Node(from, to); List <Node> frontier = new List <Node>(); // priority queue ordered by Path-Cost, with node as the only element List <Node> explored = new List <Node>(); // an empty set frontier.Add(node); while (true) { InfiniteLoopDebug.Run("Pathfind", "GetClosestReachableDest", 190); if (frontier.Count == 0) { // Debug.Log("목적지에 갈수 있는 길이 존재하지 않습니다."); return(null); // 답이 없음. } node = Node.PopSmallestCostNode(frontier); frontier.Remove(node); if (node.unitPosition.Equals(to)) // goal test { return(Node.RebuildPath(node)); } explored.Add(node); // add node.State to explored foreach (var neighbor in Node.GetAvilableNeighbor(/*agent,*/ moveSkill, node)) { bool isExplored = false; foreach (var item in explored) { if (item.unitPosition == neighbor.unitPosition) { isExplored = true; } } if (isExplored.Equals(true)) { continue; } bool isFrontiered = false; for (int i = frontier.Count - 1; i >= 0; i--) { if (frontier[i].unitPosition.Equals(neighbor.unitPosition)) { isFrontiered = true; if (neighbor.unitPosition == frontier[i].unitPosition && neighbor.evaluationCost < frontier[i].evaluationCost) { frontier.Remove(frontier[i]); frontier.Add(neighbor); } } } if (isFrontiered.Equals(false)) { frontier.Add(neighbor); } } } }
private void LoadData(List <string> heroData) { int index = 2; StringId = heroData[0].Split(' ')[1]; while (heroData[index] != ".end") { List <string> data = heroData[index++].Replace("%", "").Replace("\"", ""). Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList(); switch (data[0]) { case "rendering:": RenderingRankOverride = int.Parse(data[2]); break; case "commonfx:": if (CommonEffects == null) { CommonEffects = new CommonEffects(data); } else { CommonEffects.LoadData(data); } break; case "combat_skill:": SkillArtInfo skillArt = new SkillArtInfo(data, false); SkillArtInfo.Add(skillArt); break; case "riposte_skill:": SkillArtInfo riposteArt = new SkillArtInfo(data, false); SkillArtInfo.Add(riposteArt); break; default: Debug.LogError("Unknown art token in hero: " + StringId); break; } } index += 2; while (heroData[index] != ".end") { List <string> data = heroData[index++].Replace("%", "").Replace("\"", ""). Split(new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList(); switch (data[0]) { case "resistances:": Resistanses.Add(AttributeType.Stun, float.Parse(data[2]) / 100); Resistanses.Add(AttributeType.Poison, float.Parse(data[4]) / 100); Resistanses.Add(AttributeType.Bleed, float.Parse(data[6]) / 100); Resistanses.Add(AttributeType.Disease, float.Parse(data[8]) / 100); Resistanses.Add(AttributeType.Move, float.Parse(data[10]) / 100); Resistanses.Add(AttributeType.Debuff, float.Parse(data[12]) / 100); Resistanses.Add(AttributeType.DeathBlow, float.Parse(data[14]) / 100); Resistanses.Add(AttributeType.Trap, float.Parse(data[16]) / 100); break; case "weapon:": Equipment weapon = new Equipment(data[2], Weapons.Count + 1, HeroEquipmentSlot.Weapon); weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageLow, float.Parse(data[6]), false)); weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageHigh, float.Parse(data[7]), false)); weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.CritChance, float.Parse(data[9]) / 100, false)); weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.SpeedRating, float.Parse(data[11]), false)); Weapons.Add(weapon); break; case "armour:": Equipment armor = new Equipment(data[2], Armors.Count + 1, HeroEquipmentSlot.Armor); armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.DefenseRating, float.Parse(data[4]) / 100, false)); armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.HitPoints, float.Parse(data[8]), true)); Armors.Add(armor); break; case "combat_skill:": List <string> combatData = new List <string>(); data = heroData[index - 1].Split(new [] { '\"' }, StringSplitOptions.RemoveEmptyEntries).ToList(); bool isEffectData = false; foreach (var item in data) { if (isEffectData) { if (item.Trim(' ').StartsWith(".")) { isEffectData = false; } else { combatData.Add(item); continue; } } string[] combatItems = item.Replace("%", "").Split( new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (combatItems[combatItems.Length - 1] == ".effect") { isEffectData = true; } combatData.AddRange(combatItems); } CombatSkillVariants.Add(new CombatSkill(combatData, true)); break; case "combat_move_skill:": MoveSkill = new MoveSkill(data[2], int.Parse(data[8]), int.Parse(data[9])); break; case "riposte_skill:": List <string> riposteData = new List <string>(); data = heroData[index - 1].Split('\"').ToList(); bool isRiposteEffect = false; foreach (var item in data) { if (isRiposteEffect) { if (item.Trim(' ')[0] == '.') { isRiposteEffect = false; } else { riposteData.Add(item); continue; } } string[] combatItems = item.Replace("%", "").Split( new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (combatItems[combatItems.Length - 1] == ".effect") { isRiposteEffect = true; } riposteData.AddRange(combatItems); } RiposteSkill = new CombatSkill(riposteData, true); break; case "incompatible_party_member:": IncompatiablePartyTag = data[4]; break; case "tag:": Tags.Add(data[2]); break; case "controlled:": break; case "id_index:": IndexId = int.Parse(data[2]); break; case "skill_selection:": CanSelectCombatSkills = bool.Parse(data[2]); NumberOfSelectedCombatSkills = int.Parse(data[4]); break; case "deaths_door:": if (DeathDoor == null) { DeathDoor = new DeathDoor(data); } else { DeathDoor.LoadData(data); } break; case "generation:": if (Generation == null) { Generation = new HeroGeneration(data); } else { Generation.LoadData(data); } break; case "extra_battle_loot:": if (ExtraBattleLoot == null) { ExtraBattleLoot = new LootDefinition(data); } else { ExtraBattleLoot.LoadData(data); } break; case "extra_curio_loot:": if (ExtraCurioLoot == null) { ExtraCurioLoot = new LootDefinition(data); } else { ExtraCurioLoot.LoadData(data); } break; case "extra_stack_limit:": ExtraStackLimit = data[2]; break; case "mode:": Modes.Add(new CharacterMode(data)); break; default: Debug.LogError("Unknown info token " + data[0] + " in hero: " + StringId); break; } } CombatSkills = new List <CombatSkill>(CombatSkillVariants.FindAll(skill => skill.Level == 0)); }