public override void Init() { character = characterCreator.Create(); var equipTable = new InventoryItemCreator[] { character.equipment.head, character.equipment.shoulder, character.equipment.feet, character.equipment.body, character.equipment.legs, character.equipment.neck, character.equipment.gloves, character.equipment.waist, character.equipment.ring1, character.equipment.ring2, character.equipment.weapon, }; for (int i = 0; i < character.abilities.Count; i++) { SkillBook.Add(character.abilities[i].Create()); SkillBook[i].Caster = this; } for (int i = 0; i < equipTable.Length; i++) { if (equipTable[i] != null) { var item = equipTable[i].Create(); item.isEquipable = true; itemManager.EquipItem(item, (EquipmentSlot)i); } } ActiveEquipment[(int)EquipmentSlot.Weapon].Use(); }
public Assassin() { SkillBook.Add(new Skill("Coin Flip", $"Flip a coin and decide if you want to actually attack. +{10 + Stats.Damage} damage, or -{10 + Stats.Damage} damage.", 15f, 0f, true, DateTime.Now)); SkillBook.Add(new Skill("Cut Throat", "Slice someones ankles, cause why would you name the body part your about to attack?", 5f, 3f, true, DateTime.Now)); SkillBook.Add(new Skill("Kyūketsuki", $"Take on your shadow form and steal +{3 + Stats.Damage} health from the enemy, healing yourself", 10f, 3f, true, DateTime.Now)); SpellBook.Add(new Spell("Limit Break", $"Remove your earthly form and increase your speed by {2 + Stats.Damage}, can only be used once, and at great cost", "buff", 50f, 0f, false, DateTime.Now)); }
public override void ExitBattle(Vector3 lastPosition) { base.ExitBattle(lastPosition); Effects.DisableBattleEffects(); SkillBook.ResetSkillCooldowns(); }
private void Start() { Stats.SetCharacterStats(_enemySpec); SkillBook.LoadSkills(_enemySpec.BaseSkills); _enemyBattleAI.InitializeBattleAI(); ActiveEnemies.Add(this); }
public override Pickup Clone() { //Debug.Log("SkillBook cloning"); SkillBook skill = Instantiate <GameObject>(this.gameObject).GetComponent <SkillBook>(); return(skill); }
public void RegisterSkillBook(SkillBook skillBook) { _skillBook = skillBook; UpdateAllSlotsDisplay(); _skillBook.OnSlotChange += UpdateSkillSlotDisplay; }
private void AutoCombatPerform() { try { var character = new Character(attachedGame.Game); var mobs = new NpcContainer(attachedGame.Game).GetItems() .Where(x => x.NpcType.Value == NpcType.Monster); IEnumerable <Npc> targets = null; switch (settingVM.SearchBehavior) { case AutoCombatSearchBehavior.SearchAndDestroy: targets = mobs; break; case AutoCombatSearchBehavior.SelfDefence: targets = Enumerable.Empty <Npc>(); break; case AutoCombatSearchBehavior.Custom: targets = mobs.Where(x => settingVM.TargetList.Contains(x.Name.Value.Value)); break; } // reacquire closest target, before attacking var mob = targets .OrderBy(x => x.RelativeDistance.Value) .FirstOrDefault(); if (mob != null && mob.UniqueID != character.SelectedTargetID) { mob.Target(); } if (character.SelectedTargetID != 0) { if (AutoSparkEnabled && character.Chi > 300) { var sparkBurstID = new SkillBook(attachedGame.Game).GetItems() .Select(x => x.SkillID.Value) .FirstOrDefault(x => 0x16A <= x && x <= 0x175); // skill id for holy/demonic spark burst if (sparkBurstID != default(int)) { Call.Cast(attachedGame.Game.Core, sparkBurstID); return; } } character.Attack(); } } catch (Exception e) { Debug.WriteLine($"An exception occured in {nameof(AutoLootPerform)} : {e}"); } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jArray = JArray.Load(reader); if (objectType.Name == "SkillBook") { var book = new SkillBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = new BookSlot() { Castable = Game.World.WorldData.Values <Xml.Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name) }; var bookSlot = book[i]; if (bookSlot != null) { bookSlot.UseCount = (uint)(item.TotalUses ?? 0); bookSlot.MasteryLevel = (byte)(item.MasteryLevel == null ? (byte)0 : item.MasteryLevel); bookSlot.LastCast = (DateTime)item.LastCast; } } return(book); } else { var book = new SpellBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = new BookSlot() { Castable = Game.World.WorldData.Values <Xml.Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name) }; var castable = book[i]; var bookSlot = book[i]; if (bookSlot != null) { bookSlot.UseCount = (uint)(item.TotalUses ?? 0); bookSlot.MasteryLevel = (byte)(item.MasteryLevel == null ? (byte)0 : item.MasteryLevel); bookSlot.LastCast = (DateTime)item.LastCast; } } return(book); } }
private void Start() { _gameMaster = GameMaster.Instance; _battleManager = BattleManager.Instance; SkillBook.LoadSkills(_playerSpec.BaseSkills); Active = this; OnPlayerActive.Invoke(this); }
internal override void Draw(Graphics g) { g.DrawImage(SkillBook.GetSkillImage(skillId, 24, 24), position.X, position.Y, 24, 24); g.DrawString(word, font, Brushes.Black, position.X + 27, position.Y + 1); Brush brush = new SolidBrush(color); g.DrawString(word, font, brush, position.X + 25, position.Y); brush.Dispose(); }
public IActionResult GetSkillbook(int jobId) { SkillBook book = SkillFactory.GetSkillBook(jobId); if (book == null) { return(NotFound()); } return(Json(book)); }
void Update() { Skill _skill = SkillBook.GetSkill(skillNumber); if (_skill == null) { return; } button.interactable = PlayerMana.CurrentMana >= _skill.actionCost * 100; }
/// <summary> /// This Method will return all skills that are assail-like, Assail, Clobber, Ect. /// </summary> public Skill[] GetAssails(SkillScope scope) { if ((scope & SkillScope.Assail) == SkillScope.Assail) { return(SkillBook.Get(i => i != null && i.Template != null && i.Template.Type == SkillScope.Assail).ToArray()); } return(null); }
public void SetEquipmentAt(EquipmentSlot slot, EquipmentItem value) { switch (slot) { case EquipmentSlot.Head: Head = value; HeadId = value?.Id; break; case EquipmentSlot.Body: Body = value; BodyId = value?.Id; break; case EquipmentSlot.Boots: Boots = value; BootsId = value?.Id; break; case EquipmentSlot.Gloves: Gloves = value; GlovesId = value?.Id; break; case EquipmentSlot.LeftHand: LeftHand = value; LeftHandId = value?.Id; break; case EquipmentSlot.RightHand: RightHand = value; RightHandId = value?.Id; break; case EquipmentSlot.Neck: Neck = value; NeckId = value?.Id; break; case EquipmentSlot.LeftRing: LeftRing = value; LeftRingId = value?.Id; break; case EquipmentSlot.RightRing: RightRing = value; RightRingId = value?.Id; break; case EquipmentSlot.Skill: Skillbook = (SkillBook)value; SkillbookId = value?.Id; break; } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jArray = JArray.Load(reader); if (objectType.Name == "SkillBook") { var book = new SkillBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = Game.World.WorldData.Values <Xml.Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name); var castable = book[i]; if (castable != null) { castable.UseCount = Convert.ToUInt16(item.TotalUses == null ? 0 : item.TotalUses); castable.MasteryLevel = Convert.ToByte(item.MasteryLevel == null ? (byte)0 : item.MasteryLevel); } } return(book); } else { var book = new SpellBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = Game.World.WorldData.Values <Xml.Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name); var castable = book[i]; if (castable != null) { castable.UseCount = Convert.ToUInt16(item.TotalUses == null ? 0 : item.TotalUses); castable.MasteryLevel = Convert.ToByte(item.MasteryLevel == null ? (byte)0 : item.MasteryLevel); if (item.GetType().GetProperty("LastCast") != null) { castable.LastCast = (DateTime)item.LastCast; } else { castable.LastCast = DateTime.MinValue; } } } return(book); } }
private static void DebugSkill() { var skillbook = new SkillBook(game); skillbook.DumpProperties(); foreach (var skill in skillbook.GetItems()) { Debug.WriteLine(skill); } }
public bool HasSkill <T>(SkillScope scope) where T : Template, new() { var obj = new T(); if (obj is SkillTemplate) { if ((scope & SkillScope.Assail) == SkillScope.Assail) { return(SkillBook.Get(i => i != null && i.Template != null && i.Template.Type == SkillScope.Assail).Length > 0); } } return(false); }
private string[] GetSkillsID(SkillBook skillBook, SkillSlot slot) { var skills = skillBook.GetSkillSlots(slot); string[] array = new string[skills.Length]; for (int i = 0; i < skills.Length; i++) { array[i] = skills[i] == null ? string.Empty : skills[i].SkillSO.ID; } return(array); }
public void ClearBookUI() { foreach (SkillSlot key in _skillSlotsUI.Keys) { SkillSlotUI[] slotsUI = _skillSlotsUI[key]; for (int i = 0; i < slotsUI.Length; i++) { slotsUI[i].UpdateSlotUI(null); } } _skillBook.OnSlotChange -= UpdateSkillSlotDisplay; _skillBook = null; }
public bool HasSkill <T>(SkillScope scope) where T : Template, new() { var obj = new T(); if (obj is SkillTemplate) { // ReSharper disable once NonConstantEqualityExpressionHasConstantResult if ((scope & SkillScope.Assail) == SkillScope.Assail) { return(SkillBook.Get(i => i != null && i.Template != null && i.Template.Type == SkillScope.Assail).Length > 0); } } return(false); }
public IActionResult GetSkillFromBook(int jobId, int skillId) { SkillBook book = SkillFactory.GetSkillBook(jobId); if (book == null) { return(NotFound("Couldn't find skillbook")); } Skill skill = book.Skills.Where(c => c.id == skillId).FirstOrDefault(); if (skill == null) { return(NotFound("Couldn't find skill in book")); } return(Json(skill)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JArray jArray = JArray.Load(reader); if (objectType.Name == "SkillBook") { var book = new SkillBook(); for (byte i = 0; i < jArray.Count; i++) { Dictionary <string, object> item; if (TryGetValue(jArray[i], out item)) { book[i] = Game.World.Skills.Where( x => x.Value.Name == (string)item.FirstOrDefault().Value&& x.Value.Id == Convert.ToInt32((item.Where(y => y.Key == "Id").FirstOrDefault().Value))) .FirstOrDefault() .Value; } } return(book); } else { var book = new SpellBook(); for (byte i = 0; i < jArray.Count; i++) { Dictionary <string, object> item; if (TryGetValue(jArray[i], out item)) { book[i] = Game.World.Spells.Where( x => x.Value.Name == (string)item.FirstOrDefault().Value&& x.Value.Id == Convert.ToInt32((item.Where(y => y.Key == "Id").FirstOrDefault().Value))) .FirstOrDefault() .Value; } } return(book); } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jArray = JArray.Load(reader); if (objectType.Name == "SkillBook") { var book = new SkillBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = Game.World.WorldData.Values <Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name); var castable = book[i]; if (castable != null) { castable.CastableLevel = (byte)item.Level; } } return(book); } else { var book = new SpellBook(); for (byte i = 0; i < jArray.Count; i++) { dynamic item; if (!TryGetValue(jArray[i], out item)) { continue; } book[i] = Game.World.WorldData.Values <Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name); var castable = book[i]; if (castable != null) { castable.CastableLevel = (byte)item.Level; } } return(book); } }
static Question GetQuestionSkillInfo() { string[] eids = { "type", "des" }; string[] cids = { "类型", "描述" }; int type = MathTool.GetRandom(eids.Length); SkillConfig luk = ConfigData.GetSkillConfig(SkillBook.GetRandSkillId()); Question question = new Question(); question.info = string.Format("|技能|Gold|{0}||的{1}是?", luk.Name, cids[type]); question.ans = new string[4]; string attrType = SkillBook.GetAttrByString(luk.Id, eids[type]); question.ans[MathTool.GetRandom(4)] = attrType; int idx = 0; SimpleSet <string> set = new SimpleSet <string>(); set.Add(SkillBook.GetAttrByString(luk.Id, eids[type])); while (idx < 4) { if (question.ans[idx] != null) { idx++; continue; } SkillConfig guess = ConfigData.GetSkillConfig(SkillBook.GetRandSkillId()); string guessType = SkillBook.GetAttrByString(guess.Id, eids[type]); if (!set.Has(guessType)) { question.ans[idx] = guessType; set.Add(guessType); idx++; } } question.result = attrType; return(question); }
private List <Skill> CollectSkills(SkillBook skillBook) { List <Skill> skills = new List <Skill>(); foreach (SkillSlot slot in Enum.GetValues(typeof(SkillSlot))) { if (slot == SkillSlot.Passive) { continue; } Skill[] slots = skillBook.GetSkillSlots(slot); for (int i = 0; i < slots.Length; i++) { if (slots[i] != null) { skills.Add(slots[i]); } } } return(skills); }
public Skill[] GetAssails() { return(SkillBook.Get(i => i != null && i.Template != null && i.Template.Type == SkillScope.Assail).ToArray()); }
public virtual void ExitBattle(Vector3 lastPosition) { transform.position = lastPosition; SkillBook.TogglePassiveBattleEffects(false); }
void Start() { sb = GameObject.Find("SkillBook").GetComponent <SkillBook>(); tooltip = sb.GetComponent <SkillTooltip>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Obstacle") { speed = 0; GetComponent <Animator>().SetTrigger("Impact"); } if (myEffect == Effect.Damage) { if (collision.tag == "Hitbox" && collision.transform == MyTarget) { Character c = collision.GetComponentInParent <Character>(); speed = 0; damage += (Player.MyInstance.MyIntellect / 3); c.DamageTaken(damage, source); GetComponent <Animator>().SetTrigger("Impact"); myRigidBody.velocity = Vector2.zero; MyTarget = null; } } if (myEffect == Effect.Dps) { if (collision.tag == "Hitbox" && collision.transform == MyTarget) { Character c = collision.GetComponentInParent <Character>(); speed = 0; damage += (Player.MyInstance.MyIntellect / 3); c.DamageTakenDPS(damage, source); GetComponent <Animator>().SetTrigger("Impact"); myRigidBody.velocity = Vector2.zero; MyTarget = null; } } if (myEffect == Effect.Stun) { if (collision.tag == "Hitbox" && collision.transform == MyTarget) { Character c = collision.GetComponentInParent <Character>(); SkillBook sb = GetComponent <SkillBook>(); speed = 0; damage += (Player.MyInstance.MyIntellect / 3); c.DamageTakenStun(damage, source); GetComponent <Animator>().SetTrigger("Impact"); myRigidBody.velocity = Vector2.zero; MyTarget = null; } } if (myEffect == Effect.Heal) { if (collision.tag == "HealHitbox") { Player p = collision.GetComponentInParent <Player>(); damage += (Player.MyInstance.MyIntellect / 3); p.DamageHealed(damage); GetComponent <Animator>().SetTrigger("Impact"); myRigidBody.velocity = Vector2.zero; MyTarget = null; } } if (myEffect == Effect.Regen) { if (collision.tag == "HealHitbox") { Player p = collision.GetComponentInParent <Player>(); damage += (Player.MyInstance.MyIntellect / 3); p.DamageHealedRegen(damage); GetComponent <Animator>().SetTrigger("Impact"); myRigidBody.velocity = Vector2.zero; MyTarget = null; } } }
public SkillBook GetSkillBook(int id) => SkillBook.Parse(WZ.Resolve($"Skill/{id}"), id, GetJob(id), (c) => GetSkillDescription(c));
private SkillBook() { instance = this; }