protected override void Process(GameSession session, Ski packet) { Character character = session.Character; var old = character.Skills.ToList(); character.Skills.Clear(); foreach (int skillId in packet.Skills) { Skill skill = skillFactory.CreateSkill(skillId); if (skill.Category == SkillCategory.Player || skill.Category == SkillCategory.Partner) { character.Skills.Add(skill); } } eventPipeline.Process(session, new SkillUpdateEvent { OldSkills = old, NewSkills = character.Skills.ToList() }); Log.Debug("Skills successfully loaded"); }
static void Main(string[] args) { var skills = new List <Skill>(); skills.Add(SkillFactory.CreateSkill(SkillType.SkillOne)); skills.Add(SkillFactory.CreateSkill(SkillType.SkillTwo)); skills.Add(SkillFactory.CreateSkill(SkillType.SkillThree)); skills.Add(SkillFactory.CreateSkill(SkillType.SkillFour)); Console.WriteLine($"There is {skills.Count} starting skills:"); foreach (var skill in skills) { Console.WriteLine(skill.SkillName); } CombineFactory.Combine(CombineType.SliceAndDice, skills); CombineFactory.Combine(CombineType.DiceAndFinish, skills); Console.WriteLine($"\nAfter combine there is {skills.Count} skills:\n"); foreach (var skill in skills) { for (int i = 0; i < 5; i++) { skill.DoAttack(); } Console.WriteLine(); } }
public void Su_Packet_Set_Character_Skill_On_Cooldown() { Skill skill = SkillFactory.CreateSkill(254); Character.Skills.Add(skill); Client.ReceivePacket("su 1 999 1 999 254 333 24 281 0 0 1 100 0 -1 0"); Check.That(skill.IsOnCooldown).IsTrue(); }
public void AddSkill(string key) { if (skills.ContainsKey(key)) { return; // 이미 같은 종류 있으면 그냥 리턴. 같은 스킬 중복 불가. } skills.Add(key, SkillFactory.CreateSkill(gameObject, key)); skills[key].SetOwner(this); skills[key].InitSkill(); //skill.Activate(); }
public void Sr_Packet_Reset_Skill_Cooldown() { Skill skill = SkillFactory.CreateSkill(450); Character.Skills.Add(skill); skill.IsOnCooldown = true; Client.ReceivePacket($"sr {skill.CastId}"); Check.That(skill.IsOnCooldown).IsFalse(); }
public void Init(Unit caster) { // Test Needed this.caster = caster; for (int i = 0; i < 4; i++) { SkillCells[i] = new SkillCell(); SkillCells[i].Init(caster); // 设置初始技能 ISkill tmpSkill = SkillFactory.CreateSkill(caster.attributes.data.skills[i]); if (tmpSkill != null) { SkillCells[i].CurrentSkill = tmpSkill; } } }
//public IEnumerator RefreshTemporaryEffects() //{ // while(true) // { // yield return new WaitForSeconds(SkillConsts.TICK_TIME); // int idx = 0; // while(idx < temporaryEffects.Count) // { // if (temporaryEffects[idx].Refresh()) // RemoveTemporaryEffect(temporaryEffects[idx]); // else // idx++; // } // } //} //public void ClearTemporaryEffects() //{ // foreach (TemporaryEffect effect in temporaryEffects) // effect.RemoveEffect(); // temporaryEffects.Clear(); //} //public void RemoveTemporaryEffect(TemporaryEffect toBeRemoved) //{ // if (temporaryEffects.Contains(toBeRemoved)) // { // toBeRemoved.ResetTimer(); // 재활용할 수 있으니 리셋. // toBeRemoved.ResetStack(); // 스택도 여기서 리셋 // toBeRemoved.RemoveEffect(); // temporaryEffects.Remove(toBeRemoved); // } //} //public void AddTemporaryEffect(TemporaryEffect toBeAdded) //{ // if (!temporaryEffects.Contains(toBeAdded)) // { // toBeAdded.SetSubject(this); // toBeAdded.ApplyEffect(); // temporaryEffects.Add(toBeAdded); // } // else // { // //Debug.Log("Stacking Up"); // toBeAdded.StackUp(); // } //} #endregion #region Skill public void AddSkill(string key) { //Debug.Log(key); if (skills.ContainsKey(key)) { return; // 이미 같은 종류 있으면 그냥 리턴. 같은 스킬 중복 불가. } //Debug.Log("aaaa"); skills.Add(key, SkillFactory.CreateSkill(gameObject, key)); skills[key].SetOwner(this); skills[key].InitSkill(); if (isActiveAndEnabled == true) { skills[key].Activate(); } //Debug.Log(skills.Count); }
static void Main(string[] args) { ActiveAttackSkill skill1 = new ActiveAttackSkill("Fireball", "fires ball", ElementType.Fire, 100, TargetingType.Enemy, 2); ActiveAttackSkill skill2 = skill1.Clone(); ISkill skill3 = SkillFactory.CreateSkill(skill1, skill2); IAttackSkill skill3_attack = (IAttackSkill)skill3; skill1.hp += 1; skill2.hp -= 1; Console.WriteLine(skill1.hp); Console.WriteLine(skill2.hp); Console.WriteLine(skill3.ElementType); Console.WriteLine(skill3.Description); Console.WriteLine(skill3_attack.Damage); //todo create character //set character learned skills //set character 5 equipped skills Console.WriteLine("Hello World!"); Console.ReadKey(true); }
public CharacterInfo(CharacterConfig characterConfig) { ID = characterConfig.ID; Name = characterConfig.Name; RawAttack = Attack = characterConfig.Attack; RawDenfence = Denfence = characterConfig.Denfence; RawDodge = Dodge = characterConfig.Dodge; RawCritical = Critical = characterConfig.Critical; RawCriticalDamage = CriticalDamage = characterConfig.CriticalDamage; RawHp = Hp = characterConfig.Hp; RawSpeed = Speed = characterConfig.Speed; Exp = characterConfig.Exp; Level = 1; ActiveSkills = new List <Skill>(); foreach (var skillConfig in characterConfig.skills) { ActiveSkills.Add(SkillFactory.CreateSkill(skillConfig)); } Buffs = new List <Buff>(); foreach (var buffConfig in characterConfig.buffs) { Buffs.Add(BuffFactory.CreateBuff(buffConfig)); } }
// Create a skill public GameObject CreateSkill(int pSkillIndex) { return(SkillFactory.CreateSkill(pSkillIndex)); }