public void PutOnCooldown(Skill sk) { if (!onCooldown.Contains(sk)) { onCooldown.Add(sk); } }
void OnSkillClick(Skill skill) { PlayerInfo info = PlayerInfo._instance; this.skill = skill; this.skillNameLabel.text = this.skill.Name + " Lv." + this.skill.Level; this.skillDesLabel.text = "当前技能的攻击力为: " + (this.skill.Damage*this.skill.Level) + "\n下一级技能的攻击力为: " + (this.skill.Damage*(this.skill.Level+1)) + "\n升级所需要的金币数: " + (500*(skill.Level+1)); if((500*(this.skill.Level+1)) <= info.Coin) { if(this.skill.Level < info.Level) { SetUpgradeButtonState(true, "升级"); } else { SetUpgradeButtonState(false, "最大等级"); } } else { SetUpgradeButtonState(false, "金币不足"); } }
public void Start(Creature creature, Skill skill, Packet packet) { // Get parameters var stringParam = packet.NextIs(PacketElementType.String); var dict = new MabiDictionary(); byte unkByte = 0; if (stringParam) dict.Parse(packet.GetString()); else unkByte = packet.GetByte(); // Run skill var result = this.Start(creature, skill, dict); if (result == StartStopResult.Fail) { Send.SkillStartSilentCancel(creature, skill.Info.Id); return; } skill.Activate(SkillFlags.InUse); Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina); if (stringParam) Send.SkillStart(creature, skill, dict.ToString()); else Send.SkillStart(creature, skill, unkByte); }
/// <summary> /// Stops meditation. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="dict"></param> /// <returns></returns> public override StartStopResult Stop(Creature creature, Skill skill, MabiDictionary dict) { creature.Regens.Remove("Meditation"); creature.Conditions.Deactivate(ConditionsE.Meditation); return StartStopResult.Okay; }
public void unitMenuClosing(Skill selectedSkill) { // Small wait should occur so that key input not observed immediately. wait = true; if (selectedSkill == null) job = Job.SelectingSpace; else { job = Job.SelectingTarget; currentSkill = selectedSkill; // Remove old markers, which indicated valid spaces to move to foreach (GameObject o in markers) Destroy(o); // Add new markers skillRange = selectedSkill.getRange (onlyValid: false); foreach ( Loc target in skillRange ) { // Add all appropriate markers and store them in a list so they can be removed later markers.Add( Object.Instantiate (Resources.Load ("marker"), World.current.onGround(target), Quaternion.identity) as GameObject); } } // Either way, enable movement Cursor.canMove = true; }
/// <summary> /// Constructor /// </summary> /// <param name="skill">skill to edit</param> public SkillProperties(MainPage parent, Skill skill) { InitializeComponent(); nameBox.TextChanged += Filter.FilterString; descriptionBox.TextChanged += Filter.FilterString; messageBox.TextChanged += Filter.FilterString; permissionBox.TextChanged += Filter.FilterString; indicatorBox.TextChanged += Filter.FilterMaterial; indicatorBox.TextChanged += UpdateDataBox; maxLevelBox.TextChanged += Filter.FilterInt; itemReqBox.TextChanged += Filter.FilterMaterials; requiredLevelBox.TextChanged += Filter.FilterInt; levelBaseBox.TextChanged += Filter.FilterInt; levelBonusBox.TextChanged += Filter.FilterInt; costBaseBox.TextChanged += Filter.FilterInt; costBonusBox.TextChanged += Filter.FilterNInt; manaBaseBox.TextChanged += Filter.FilterInt; manaBonusBox.TextChanged += Filter.FilterNInt; cooldownBaseBox.TextChanged += Filter.FilterDouble; cooldownBonusBox.TextChanged += Filter.FilterNDouble; rangeBaseBox.TextChanged += Filter.FilterDouble; rangeBonusBox.TextChanged += Filter.FilterNDouble; radiusBaseBox.TextChanged += Filter.FilterDouble; radiusBonusBox.TextChanged += Filter.FilterNDouble; periodBaseBox.TextChanged += Filter.FilterDouble; periodBonusBox.TextChanged += Filter.FilterNDouble; this.parent = parent; this.skill = skill; Apply(); }
/// <summary> /// Readies the skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> /// <returns></returns> public bool Ready(Creature creature, Skill skill, Packet packet) { Send.UseMotion(creature, 10, 0); Send.SkillReady(creature, skill.Info.Id); return true; }
/// <summary> /// Get skill information for a specific skill from the specified UO client. /// </summary> public static SkillInfo GetSkillInfo(int client, Skill skill) { ClientInfo ci; if (ClientInfoCollection.GetClient(client, out ci)) return ci.GetSkillInfo((int)skill); return null; }
public bool Prepare(Creature creature, Skill skill, Packet packet) { Send.SkillFlashEffect(creature); Send.SkillPrepare(creature, skill.Info.Id, skill.GetCastTime()); return true; }
/// <summary> /// Handles healing training. /// </summary> /// <param name="creature"></param> /// <param name="target"></param> /// <param name="skill"></param> private void OnPlayerHealsCreature(Creature creature, Creature target, Skill healingSkill) { var skill = creature.Skills.Get(SkillId.MagicMastery); if (skill == null) return; if (healingSkill.Info.Id == SkillId.Healing) { var index = 0; if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RD) index = 1; else if (skill.Info.Rank >= SkillRank.RC && skill.Info.Rank <= SkillRank.R6) index = 3; if (index != 0) { skill.Train(index); // Use Healing magic on an injured person. if (target.Life < 0) skill.Train(index + 1); // Use Healing magic on a critically injured person. } } else if (healingSkill.Info.Id == SkillId.PartyHealing && !creature.IsGiant) { if (skill.Info.Rank >= SkillRank.R5 && skill.Info.Rank <= SkillRank.R1) skill.Train(7); // Use Party Healing. } }
/// <summary> /// Bolt specific use code. /// </summary> /// <param name="attacker"></param> /// <param name="skill"></param> /// <param name="target"></param> protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature mainTarget) { // Create actions var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, skill.Info.Id, mainTarget.EntityId); aAction.Set(AttackerOptions.Result); var cap = new CombatActionPack(attacker, skill.Info.Id, aAction); var targets = new List<Creature>(); targets.Add(mainTarget); targets.AddRange(mainTarget.Region.GetCreaturesInRange(mainTarget.GetPosition(), SplashRange).Where(a => a != mainTarget && attacker.CanTarget(a) && attacker.CanAttack(a))); // Damage var damage = this.GetDamage(attacker, skill); var max = Math.Min(targets.Count, skill.Stacks); for (int i = 0; i < max; ++i) { var target = targets[i]; var targetDamage = damage; target.StopMove(); var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id); tAction.Set(TargetOptions.Result); tAction.Stun = TargetStun; // Full damage for the first target, -10% for every subsequent one. targetDamage -= (targetDamage * 0.1f) * i; // Reduce damage var maxDamage = damage; //Damage without Defense and Protection // Reduce damage Defense.Handle(aAction, tAction); SkillHelper.HandleMagicDefenseProtection(target, ref targetDamage); ManaShield.Handle(target, ref targetDamage, tAction, maxDamage, true); // Deal damage if (targetDamage > 0) target.TakeDamage(tAction.Damage = targetDamage, attacker); if (target == mainTarget) target.Aggro(attacker); // Death/Knockback this.HandleKnockBack(attacker, target, tAction); cap.Add(tAction); } // Override stun set by defense aAction.Stun = AttackerStun; Send.Effect(attacker, Effect.UseMagic, EffectSkillName); Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1); this.BeforeHandlingPack(attacker, skill); cap.Handle(); }
protected virtual int GetProgress(ConquestState state, Skill skill) { if (skill == null) { return 0; } if (state.User == null) return 0; if ((Skill != (SkillName)skill.SkillID)) { if (ChangeSkillReset) { return -state.Progress; } return 0; } if (SkillAmount != 0 && SkillAmount > state.User.Skills[Skill].Value) { return 0; } return 1; }
/// <summary> /// Readies the skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> /// <returns></returns> public override bool Ready(Creature creature, Skill skill, Packet packet) { Send.Effect(creature, 5, (byte)0); Send.SkillReady(creature, skill.Info.Id); return true; }
/// <summary> /// Prepares skill, skips right to used. /// </summary> /// <remarks> /// Doesn't check anything, like what you can gather with what, /// because at this point there's no chance for abuse. /// </remarks> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> /// <returns></returns> public bool Prepare(Creature creature, Skill skill, Packet packet) { var entityId = packet.GetLong(); var collectId = packet.GetInt(); // You shall stop creature.StopMove(); var creaturePosition = creature.GetPosition(); // Get target (either prop or creature) var targetEntity = this.GetTargetEntity(creature.Region, entityId); if (targetEntity != null) creature.Temp.GatheringTargetPosition = targetEntity.GetPosition(); // Check distance if (!creaturePosition.InRange(creature.Temp.GatheringTargetPosition, MaxDistance)) { Send.Notice(creature, Localization.Get("Your arms are too short to reach that from here.")); return false; } // ? (sets creatures position on the client side) Send.CollectAnimation(creature, entityId, collectId, creaturePosition); // Use Send.SkillUse(creature, skill.Info.Id, entityId, collectId); skill.State = SkillState.Used; return true; }
public static void ChangeSkillLock(int client, Skill skill, LockStatus lockStatus) { byte[] packet = new byte[] { 0x3A, 0x00, 0x06, 0x00, 0x00, 0x00 }; packet[4] = (byte)skill; packet[5] = (byte)lockStatus; SendPacketToServer(client, packet); }
//assign a new skill to the manager (put into the list) return whether the change is successful public static bool ChangeSkill(Skill skill, int index) { if((skill.attack_type != status_manager.weapon_type && skill.attack_type != Skill.AttackType.anytype) || skill.level_req > status_manager.level) { return false; } //if skill is already there for(int i = 0; i < 6; ++i) { if(skills[i] != null && skills[i].id == skill.id) { skills[i].Remove(); skills[i] = null; StatusGUIManager.EmptySkillIcon(i); SkillSlotManager.EmptySkill(i); } } if(skills[index] != null) { skills[index].Remove(); } StatusGUIManager.ChangeSkillIcon(index, skill.icon); SkillSlotManager.AssignSkill(index, skill); skill.ownership = Skill.Ownership.player; skill.SetUp(status_manager); skills[index] = skill; return true; }
/// <summary> /// Completes skill, dropping a cobweb. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> public void Complete(Creature creature, Skill skill, Packet packet) { var cobweb = new Item(ItemId); cobweb.Drop(creature.Region, creature.GetPosition(), 200, creature, true); Send.SkillComplete(creature, skill.Info.Id); }
/// <summary> /// Prepares skill, goes straight to use to skip readying and using it. /// </summary> /// <remarks> /// The client will take a moment to send the Complete packet, /// as if it would cast the skill first. /// </remarks> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> public bool Prepare(Creature creature, Skill skill, Packet packet) { Send.SkillUse(creature, skill.Info.Id, 0); skill.State = SkillState.Used; return true; }
public void Complete(Creature creature, Skill skill, Packet packet) { var str = packet.GetString(); var dict = new MabiDictionary(str); var hwEntityId = dict.GetLong("ITEMID"); if (hwEntityId == 0) goto L_End; var hw = creature.Inventory.GetItemSafe(hwEntityId); if (!hw.HasTag("/large_blessing_potion/")) goto L_End; // TODO: Check loading time var items = creature.Inventory.GetEquipment(); foreach (var item in items) { var blessable = (item.HasTag("/equip/") && !item.HasTag("/not_bless/")); if (blessable) item.OptionInfo.Flags |= ItemFlags.Blessed; } creature.Inventory.Decrement(hw, 1); Send.ItemBlessed(creature, items); L_End: Send.UseMotion(creature, 14, 0); Send.SkillComplete(creature, skill.Info.Id, str); }
/// <summary> /// 初始化 /// </summary> public override void Init(Skill Skill, XmlNode data) { base.Init(Skill, data); Dealy = Skill_Manager.GetXmlAttrFloat(data, "delay"); LifeTime = Skill_Manager.GetXmlAttrFloat(data, "lifetime"); CD = Skill_Manager.GetXmlAttrFloat(data, "cd"); }
public void ReceiveMouseInput(GameObject clicked) { Enemy enemy = clicked.GetComponent<Enemy>(); if (enemy) { bool success; if (m_currentSkill && enemy.m_skillWeakTo == m_currentSkill.m_color) { success = enemy.TakeDamage(m_currentSkill.Strength()); } else { success = enemy.TakeDamage(0); } if (success && m_currentSkill) { m_currentSkill.Grow(); } } Skill skill = clicked.GetComponent<Skill>(); if (skill) { m_currentSkill = skill; GameManager.instance.SetCursorFromCurrentSkill(m_currentSkill.m_color); } }
/// <summary> /// Starts the skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="dict"></param> /// <returns></returns> public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict) { creature.Conditions.Activate(ConditionsA.ManaShield); Send.Effect(creature, Effect.ManaShield); return StartStopResult.Okay; }
public Level(XmlNode data) { this.data = data; target = data.FindSkills().First(); level = data.GetInt(); xp = data.Child(XP).GetFloat(); }
public override void OnEnable() { useFormulae = false; s = target as Skill; base.OnEnable(); name = "Skill"; }
/// <summary> /// Starts Mana Deflector. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="dict"></param> /// <returns></returns> public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict) { // Give an indication of activation, official behavior unknown. Send.Notice(creature, Localization.Get("Mana Deflector activated.")); return StartStopResult.Okay; }
/// <summary> /// Handles usage of the skill if it's a regular dye. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> /// <param name="part"></param> private void UseRegular(Creature creature, Skill skill, Packet packet, int part) { var x = packet.GetShort(); var y = packet.GetShort(); Send.SkillUseDye(creature, skill.Info.Id, part, x, y); }
public Task_Execute_Skill(Skill skill, Unit user, Tile epicenter, object[] args) { this.skill = skill; this.user = user; this.epicenter = epicenter; this.args = args; }
public static Skill getAcidBlade() { if (acidBlade == null) { acidBlade = new Skill(); acidBlade.name = "Acid\nBlade"; acidBlade.icon = Resources.Load<Sprite>("SpellVisuals/ASSASSIN/ACID BLADE/acid blade"); acidBlade.description = "Weaker than Shiv but corrodes your enemy's armor!"; acidBlade.basePower = 3; acidBlade.aoe = 0; acidBlade.range = 1; acidBlade.manaCost = user => 0; acidBlade.cooldown = 3; acidBlade.damageType = Skill.DamageType.DAMAGE; acidBlade.targetType = Skill.TargetType.ENEMY; acidBlade.OnTarget = (user, target, args) => { float amt = user.DamageMultiplier * acidBlade.basePower; target.TakeDamage(amt, user); target.AddEffect(EffectFactory.GetWeakenDefenseEffect(), 3); }; acidBlade.GenerateTasks = (user, tile, args) => { List<Unit> list = acidBlade.gatherTargets(user, tile); GameManager.instance.tasks.Add(new Task_Face_Eachother(user, tile.unit)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch")); GameManager.instance.tasks.Add(new Task_Wait(0.3f)); GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load<AudioClip>("SE/Sward4"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/ASSASSIN/shiv/shiv prefab"), tile.transform.position, 1)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(tile.unit, "Hit")); acidBlade.EnqueueExecuteTask(user, tile, args); }; } return acidBlade; }
/// <summary> /// Completes skill, warping to destination. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="packet"></param> public void Complete(Creature creature, Skill skill, Packet packet) { var destination = (Continent)packet.GetByte(); int regionId, x, y; switch (destination) { case Continent.Uladh: if (creature.Keywords.Has("portal_dunbarton")) { regionId = 14; x = 41598; y = 36010; // Dun } else { regionId = 1; x = 12789; y = 38399; // Tir } break; case Continent.Iria: regionId = 3001; x = 164837; y = 170144; // Qilla break; case Continent.Belvast: regionId = 4005; x = 41760; y = 26924; // Belvast break; default: Send.Notice(creature, "Unknown destination."); Send.SkillCancel(creature); return; } creature.Warp(regionId, x, y); Send.SkillComplete(creature, skill.Info.Id, (byte)destination); }
public static SkillController CreateSkillController(Skill skill) { var prefab = Resources.Load(skill.PrefabPath) as GameObject; var go = GameObject.Instantiate(prefab) as GameObject; var controller = go.GetComponent<SkillController>(); return controller; }
void Update() { // 既に死んでいたら何もしない if (isDead) { return; } // 自分のターンでなければ何もしない if (battleState == BattleState.Idle) { return; } /* * // アニメーションが終わっていなければ何もしない * if (!isDoneAnimation) * { * return; * } */ // 選択したアニメーションによって処理を分ける if (battleState == BattleState.DirectAttack) { //ShowEffectOnTheTarget(); DirectAttack(); // 自分のターンが来たので上がったパラメータのチェック CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } else if (battleState == BattleState.MagicAttack) { //ShowEffectOnTheTarget(); MagicAttack(); // 自分のターンが来たので上がったパラメータのチェック CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } else if (battleState == BattleState.Healing || battleState == BattleState.NumbnessRecoveryMagic || battleState == BattleState.PoisonnouRecoveryMagic ) { //ShowEffectOnTheTarget(); UseMagic(); // 自分のターンが来たので上がったパラメータのチェック CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } else if (battleState == BattleState.IncreaseAttackPowerMagic) { //ShowEffectOnTheTarget(); UseMagic(); // 自身の攻撃力をアップした場合はターン数をカウントしない if (currentTarget == this.gameObject) { CheckIncreaseStrikingStrength(); } else { CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } } else if (battleState == BattleState.IncreaseDefencePowerMagic) { //ShowEffectOnTheTarget(); UseMagic(); // 自身の防御力をアップした場合はターン数をカウントしない if (currentTarget == this.gameObject) { CheckIncreaseAttackPower(); } else { CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } } else if (battleState == BattleState.UseHPRecoveryItem || battleState == BattleState.UseMPRecoveryItem || battleState == BattleState.UseNumbnessRecoveryItem || battleState == BattleState.UsePoisonRecoveryItem ) { UseItem(); // 自分のターンが来たので上がったパラメータのチェック CheckIncreaseAttackPower(); CheckIncreaseStrikingStrength(); } // ターゲットのリセット currentTarget = null; currentSkill = null; currentItem = null; targetCharacterBattleScript = null; targetCharacterStatus = null; battleState = BattleState.Idle; // 自身の選択が終了したら次のキャラクターにする battleManager.ChangeNextChara(); isDoneAnimation = false; }
public Gaina() { Name = "Gaina"; Image = Graphics.resources.Res.Gaina; SetMaxHp(777); SetMaxEnergy(200); SetEnergyRegen(20); SetAbilityPower(50); SetAttackRange(7); Blasts = new List <Specials.Pyroblast>(); Collider = new Perk { StartTurn = (s) => (d) => { var list = new List <Pyroblast>(Blasts); foreach (var pyro in list) { pyro.Boom(); } return(s(d)); }, SkillFix = (s) => { var newSkill = new Skill() { Name = s.Name, CoolDown = s.CoolDown, SkillTypes = s.SkillTypes, Explanation = s.Explanation, }; newSkill.Job = (he) => { var res = s.Job(he); if (res) { var list = new List <Pyroblast>(Blasts); foreach (var pyro in list) { pyro.Boom(); } return(true); } return(false); }; return(newSkill); }, EndTurn = (v) => (d) => { foreach (var pyro in Blasts) { pyro.Tick(); } var list = new List <Pyroblast>(Blasts); foreach (var pyro in list) { pyro.Boom(); } return(v(d)); } }; Perks.Add(new Perk { StartTurn = (f) => (d) => { foreach (var h in d.HeroValue.M.GetHeroes()) { if (!h.Perks.Contains(Collider)) { h.Perks.Add(Collider); } } return(f(d)); }, }); Pyroblast = new Skill { Name = "Pyroblast", Explanation = () => "Shoots pyroblast that moves diagonally and bounce off of stones and deales " + PyroblastAPScale * 100 + "%AP (" + GetAbilityPower() * PyroblastAPScale + ") spell damage to all enemies in " + PyroblastRadius + " range when fly on them. Cost " + PyroblastCost + ". CD " + PyroblastCd, EnergyCost = PyroblastCost, CoolDown = PyroblastCd, Job = (h) => { var directions = new List <Point> { new Point(1, 1), new Point(-1, 1), new Point(-1, -1), new Point(1, -1) }; var positions = directions.Select(d => d + h.GetPosition()).Where(p => h.M.CellIsFree(p)).ToList(); var point = ChoosePoint(positions, h.P); if (point == null) { return(false); } var pyro = new Pyroblast(h) { Direction = new Point(point.X - h.GetPosition().X, point.Y - h.GetPosition().Y) }; pyro.Boom = () => { var place = h.M.UnitPositions[pyro]; var targets = h.M.GetHeroPositions().Where(a => a.Key.P != h.P && place.GetStepsTo(a.Value) <= PyroblasTriggerRadius) .Select(a => a.Key); if (targets.Count() == 0) { return(false); } var damage = new Damage(h, h.P, magic: GetAbilityPower() * PyroblastAPScale); targets = h.M.GetHeroPositions().Where(a => a.Key.P != h.P && place.GetStepsTo(a.Value) <= PyroblastRadius).Select(a => a.Key); foreach (var tg in targets) { tg.GetDamage(damage); } Blasts.Remove(pyro); h.M.UnitPositions.Remove(pyro); return(true); }; pyro.Tick = () => { var curretPoint = h.M.UnitPositions[pyro]; var nextPoint = curretPoint + pyro.Direction; if (h.M.IsInBounds(nextPoint) && h.M.MapTiles[nextPoint.X, nextPoint.Y].Type == TileType.Empty) { h.M.UnitPositions[pyro] = nextPoint; return; } var one = curretPoint + new Point(pyro.Direction.X, 0); var another = curretPoint + new Point(0, pyro.Direction.Y); var oneCool = h.M.IsInBounds(one) && h.M.MapTiles[one.X, one.Y].Type == TileType.Empty; var anotherCool = h.M.IsInBounds(another) && h.M.MapTiles[another.X, another.Y].Type == TileType.Empty; if (oneCool == anotherCool) { pyro.Direction = new Point(-pyro.Direction.X, -pyro.Direction.Y); h.M.UnitPositions[pyro] = curretPoint + pyro.Direction; return; } if (oneCool) { var newDirection = new Point(pyro.Direction.X, -pyro.Direction.Y); var newPosition = curretPoint + newDirection; if (h.M.IsInBounds(newPosition) && h.M.MapTiles[newPosition.X, newPosition.Y].Type == TileType.Empty) { pyro.Direction = newDirection; h.M.UnitPositions[pyro] = curretPoint + pyro.Direction; return; } } if (anotherCool) { var newDirection = new Point(-pyro.Direction.X, pyro.Direction.Y); var newPosition = curretPoint + newDirection; if (h.M.IsInBounds(newPosition) && h.M.MapTiles[newPosition.X, newPosition.Y].Type == TileType.Empty) { pyro.Direction = new Point(-pyro.Direction.X, pyro.Direction.Y); h.M.UnitPositions[pyro] = curretPoint + pyro.Direction; return; } } pyro.Direction = new Point(-pyro.Direction.X, -pyro.Direction.Y); h.M.UnitPositions[pyro] = curretPoint + pyro.Direction; }; Blasts.Add(pyro); h.M.UnitPositions[pyro] = point; return(true); } }; Pyroblast.SkillTypes.Add(SkillType.Special); Skills.Add(Pyroblast); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } var userId = UserId; var company = databaseContext.Companies .Where(c => c.Name.ToUpper().Contains(Input.Company) || c.Identifier.ToUpper().Contains(Input.Company)); int companyId = 0; if (company.Any()) { companyId = company.Single().Id; } else { companyId = CreateCompany(Input.Company).Id; } var interview = new Interview { CandidateId = userId, CompanyId = companyId, Experience = Input.Experience, Location = Input.Location, PostedOn = DateTime.Now, Source = Input.Source, Title = Input.Title, Rounds = new List <InterviewRound>(), Identifier = GetIdentifier(Input.Title) }; if (Input.Rounds != null && Input.Rounds.Any()) { foreach (var round in Input.Rounds) { var iRound = new InterviewRound { Detail = round.Desc, RoundType = round.Type, Questions = new List <Question>() }; if (round.Questions != null && round.Questions.Any()) { foreach (var ques in round.Questions) { var iQues = new Question { Detail = ques.Question }; if (!string.IsNullOrWhiteSpace(ques.Skill)) { var skillInDb = databaseContext.Skills.Where(s => s.Name == ques.Skill); Skill skill; if (!skillInDb.Any()) { skill = new Skill { Name = ques.Skill } } ; else { skill = skillInDb.Single(); } iQues.Skill = skill; } iRound.Questions.Add(iQues); } } interview.Rounds.Add(iRound); } } databaseContext.Interviews.Add(interview); databaseContext.SaveChanges(); return(new RedirectToPageResult("Interview")); }
/// <summary> /// Cancels skill (do nothing). /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> public void Cancel(Creature creature, Skill skill) { }
public static void Gain(Mobile from, Skill skill) { if (from.Region.IsPartOf <Regions.Jail>()) { return; } if (from is BaseCreature && ((BaseCreature)from).IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { int toGain = 1; Skills skills = from.Skills; if (from is PlayerMobile && Siege.SiegeShard) { int minsPerGain = Siege.MinutesPerGain(from, skill); if (minsPerGain > 0) { if (skills.Total + toGain <= skills.Cap && Siege.CheckSkillGain((PlayerMobile)from, minsPerGain, skill)) { skill.BaseFixedPoint += toGain; } return; } } if (skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } #region Mondain's Legacy if (from is PlayerMobile) { if (Server.Engines.Quests.QuestHelper.EnhancedSkill((PlayerMobile)from, skill)) { toGain *= Utility.RandomMinMax(2, 4); } } #endregion #region Scroll of Alacrity if (from is PlayerMobile) { PlayerMobile pm = from as PlayerMobile; if (pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow) { pm.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. toGain = Utility.RandomMinMax(2, 5); } } #endregion if (from.Player && (skills.Total / skills.Cap) >= Utility.RandomDouble())//( skills.Total >= skills.Cap ) { for (int i = 0; i < skills.Length; ++i) { Skill toLower = skills[i]; if (toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain) { toLower.BaseFixedPoint -= toGain; break; } } } #region Skill Masteries else if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) { Mobile master = ((BaseCreature)from).GetMaster(); if (master != null) { WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell; if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map && spell.EnhancedGainChance >= Utility.Random(100)) { toGain = Utility.RandomMinMax(2, 5); } } } #endregion if (!from.Player || (skills.Total + toGain) <= skills.Cap) { skill.BaseFixedPoint += toGain; } } #region Mondain's Legacy if (from is PlayerMobile) { Server.Engines.Quests.QuestHelper.CheckSkill((PlayerMobile)from, skill); } #endregion if (skill.Lock == SkillLock.Up && (!Siege.SiegeShard || !(from is PlayerMobile) || Siege.CanGainStat((PlayerMobile)from))) { SkillInfo info = skill.Info; // Old gain mechanic if (!Core.ML) { if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Str); } else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Dex); } else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Int); } } else { TryStatGain(info, from); } } }
public SkillCastItem(long castStartTime, long castEndTime, SkillCastType type, Skill skill) : base(castStartTime) { CastEndTime = castEndTime; Type = type; Skill = skill; }
public Destroyer(Skill skill) : base(skill) { _skill = skill; }
public static bool HasMastery(Mobile mobile, SkillName name) { Skill sk = mobile.Skills[name]; return(sk.IsMastery && sk.VolumeLearned != 0); }
void Awake() { instance = this; tween = GetComponent <TweenPosition>(); }
private static string OrderByCallback(Skill skill) => skill.IsPerk ? (skill.SkillRequirements.Count > 0 ? skill.SkillRequirements[0].SkillRequired : skill.IsPerk.ToString()) : skill.Name;
/// <inheritdoc /> public void ShowSkillAnimation(IAttacker attacker, IAttackable target, Skill skill) { this.ShowSkillAnimation(attacker, target, skill.Number); }
void Awake() { mySkill = this.GetComponent <Skill>(); mySkill.setSkillNumber(Constants.magicMirror); }
public ActionResult AddSkill(Skill s) { c.Skills.Add(s); c.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Create a Critter, put them into Career Mode, link them, and open the newly-created Critter. /// </summary> /// <param name="strCritterName">Name of the Critter's Metatype.</param> /// <param name="intForce">Critter's Force.</param> private void CreateCritter(string strCritterName, int intForce) { // The Critter should use the same settings file as the character. Character objCharacter = new Character(); objCharacter.SettingsFile = _objSpirit.CharacterObject.SettingsFile; // Override the defaults for the setting. objCharacter.IgnoreRules = true; objCharacter.IsCritter = true; objCharacter.BuildMethod = CharacterBuildMethod.Karma; objCharacter.BuildPoints = 0; if (txtCritterName.Text != string.Empty) { objCharacter.Name = txtCritterName.Text; } // Make sure that Running Wild is one of the allowed source books since most of the Critter Powers come from this book. bool blnRunningWild = false; blnRunningWild = (objCharacter.Options.Books.Contains("RW")); if (!blnRunningWild) { MessageBox.Show(LanguageManager.Instance.GetString("Message_Main_RunningWild"), LanguageManager.Instance.GetString("MessageTitle_Main_RunningWild"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // Ask the user to select a filename for the new character. string strForce = LanguageManager.Instance.GetString("String_Force"); if (_objSpirit.EntityType == SpiritType.Sprite) { strForce = LanguageManager.Instance.GetString("String_Rating"); } SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Chummer5 Files (*.chum5)|*.chum5|All Files (*.*)|*.*"; saveFileDialog.FileName = strCritterName + " (" + strForce + " " + _objSpirit.Force.ToString() + ").chum5"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string strFileName = saveFileDialog.FileName; objCharacter.FileName = strFileName; } else { return; } // Code from frmMetatype. ImprovementManager objImprovementManager = new ImprovementManager(objCharacter); XmlDocument objXmlDocument = XmlManager.Instance.Load("critters.xml"); XmlNode objXmlMetatype = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + strCritterName + "\"]"); // If the Critter could not be found, show an error and get out of here. if (objXmlMetatype == null) { MessageBox.Show(LanguageManager.Instance.GetString("Message_UnknownCritterType").Replace("{0}", strCritterName), LanguageManager.Instance.GetString("MessageTitle_SelectCritterType"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Set Metatype information. if (strCritterName == "Ally Spirit") { objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0)); objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0)); objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0)); objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0)); objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0)); objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0)); objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0)); objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0)); objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0)); objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0)); objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0)); objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0)); objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0)); } else { int intMinModifier = -3; if (objXmlMetatype["category"].InnerText == "Mutant Critters") { intMinModifier = 0; } objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3)); objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3)); objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3)); objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3)); objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3)); objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3)); objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3)); objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3)); objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0)); objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3)); objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3)); objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3)); objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0)); } // If we're working with a Critter, set the Attributes to their default values. objCharacter.BOD.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0)); objCharacter.AGI.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0)); objCharacter.REA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0)); objCharacter.STR.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0)); objCharacter.CHA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0)); objCharacter.INT.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0)); objCharacter.LOG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0)); objCharacter.WIL.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0)); objCharacter.MAG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0)); objCharacter.RES.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0)); objCharacter.EDG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0)); objCharacter.ESS.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0)); // Sprites can never have Physical Attributes or WIL. if (objXmlMetatype["category"].InnerText.EndsWith("Sprite")) { objCharacter.BOD.AssignLimits("0", "0", "0"); objCharacter.AGI.AssignLimits("0", "0", "0"); objCharacter.REA.AssignLimits("0", "0", "0"); objCharacter.STR.AssignLimits("0", "0", "0"); objCharacter.WIL.AssignLimits("0", "0", "0"); objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0)); objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0)); } objCharacter.Metatype = strCritterName; objCharacter.MetatypeCategory = objXmlMetatype["category"].InnerText; objCharacter.Metavariant = ""; objCharacter.MetatypeBP = 0; if (objXmlMetatype["movement"] != null) { objCharacter.Movement = objXmlMetatype["movement"].InnerText; } // Load the Qualities file. XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml"); // Determine if the Metatype has any bonuses. if (objXmlMetatype.InnerXml.Contains("bonus")) { objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metatype, strCritterName, objXmlMetatype.SelectSingleNode("bonus"), false, 1, strCritterName); } // Create the Qualities that come with the Metatype. foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/positive/quality")) { XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]"); TreeNode objNode = new TreeNode(); List <Weapon> objWeapons = new List <Weapon>(); List <TreeNode> objWeaponNodes = new List <TreeNode>(); Quality objQuality = new Quality(objCharacter); string strForceValue = ""; if (objXmlQualityItem.Attributes["select"] != null) { strForceValue = objXmlQualityItem.Attributes["select"].InnerText; } QualitySource objSource = new QualitySource(); objSource = QualitySource.Metatype; if (objXmlQualityItem.Attributes["removable"] != null) { objSource = QualitySource.MetatypeRemovable; } objQuality.Create(objXmlQuality, objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue); objCharacter.Qualities.Add(objQuality); // Add any created Weapons to the character. foreach (Weapon objWeapon in objWeapons) { objCharacter.Weapons.Add(objWeapon); } } foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/negative/quality")) { XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]"); TreeNode objNode = new TreeNode(); List <Weapon> objWeapons = new List <Weapon>(); List <TreeNode> objWeaponNodes = new List <TreeNode>(); Quality objQuality = new Quality(objCharacter); string strForceValue = ""; if (objXmlQualityItem.Attributes["select"] != null) { strForceValue = objXmlQualityItem.Attributes["select"].InnerText; } QualitySource objSource = new QualitySource(); objSource = QualitySource.Metatype; if (objXmlQualityItem.Attributes["removable"] != null) { objSource = QualitySource.MetatypeRemovable; } objQuality.Create(objXmlQuality, objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue); objCharacter.Qualities.Add(objQuality); // Add any created Weapons to the character. foreach (Weapon objWeapon in objWeapons) { objCharacter.Weapons.Add(objWeapon); } } // Add any Critter Powers the Metatype/Critter should have. XmlNode objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + objCharacter.Metatype + "\"]"); objXmlDocument = XmlManager.Instance.Load("critterpowers.xml"); foreach (XmlNode objXmlPower in objXmlCritter.SelectNodes("powers/power")) { XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]"); TreeNode objNode = new TreeNode(); CritterPower objPower = new CritterPower(objCharacter); string strForcedValue = ""; int intRating = 0; if (objXmlPower.Attributes["rating"] != null) { intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText); } if (objXmlPower.Attributes["select"] != null) { strForcedValue = objXmlPower.Attributes["select"].InnerText; } objPower.Create(objXmlCritterPower, objCharacter, objNode, intRating, strForcedValue); objCharacter.CritterPowers.Add(objPower); } // Set the Skill Ratings for the Critter. foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/skill")) { if (objXmlSkill.InnerText.Contains("Exotic")) { Skill objExotic = new Skill(objCharacter); objExotic.ExoticSkill = true; objExotic.Attribute = "AGI"; if (objXmlSkill.Attributes["spec"] != null) { SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText); objExotic.Specializations.Add(objSpec); } if (Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)) > 6) { objExotic.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); } objExotic.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); objExotic.Name = objXmlSkill.InnerText; objCharacter.Skills.Add(objExotic); } else { foreach (Skill objSkill in objCharacter.Skills) { if (objSkill.Name == objXmlSkill.InnerText) { if (objXmlSkill.Attributes["spec"] != null) { SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText); objSkill.Specializations.Add(objSpec); } if (Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)) > 6) { objSkill.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); } objSkill.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); break; } } } } // Set the Skill Group Ratings for the Critter. foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/group")) { foreach (SkillGroup objSkill in objCharacter.SkillGroups) { if (objSkill.Name == objXmlSkill.InnerText) { objSkill.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); objSkill.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); break; } } } // Set the Knowledge Skill Ratings for the Critter. foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/knowledge")) { Skill objKnowledge = new Skill(objCharacter); objKnowledge.Name = objXmlSkill.InnerText; objKnowledge.KnowledgeSkill = true; if (objXmlSkill.Attributes["spec"] != null) { SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText); objKnowledge.Specializations.Add(objSpec); } objKnowledge.SkillCategory = objXmlSkill.Attributes["category"].InnerText; if (Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText) > 6) { objKnowledge.RatingMaximum = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText); } objKnowledge.Rating = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText); objCharacter.Skills.Add(objKnowledge); } // If this is a Critter with a Force (which dictates their Skill Rating/Maximum Skill Rating), set their Skill Rating Maximums. if (intForce > 0) { int intMaxRating = intForce; // Determine the highest Skill Rating the Critter has. foreach (Skill objSkill in objCharacter.Skills) { if (objSkill.RatingMaximum > intMaxRating) { intMaxRating = objSkill.RatingMaximum; } } // Now that we know the upper limit, set all of the Skill Rating Maximums to match. foreach (Skill objSkill in objCharacter.Skills) { objSkill.RatingMaximum = intMaxRating; } foreach (SkillGroup objGroup in objCharacter.SkillGroups) { objGroup.RatingMaximum = intMaxRating; } // Set the MaxSkillRating for the character so it can be used later when they add new Knowledge Skills or Exotic Skills. objCharacter.MaxSkillRating = intMaxRating; } // Add any Complex Forms the Critter comes with (typically Sprites) XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml"); foreach (XmlNode objXmlComplexForm in objXmlCritter.SelectNodes("complexforms/complexform")) { string strForceValue = ""; if (objXmlComplexForm.Attributes["select"] != null) { strForceValue = objXmlComplexForm.Attributes["select"].InnerText; } XmlNode objXmlProgram = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlComplexForm.InnerText + "\"]"); TreeNode objNode = new TreeNode(); ComplexForm objProgram = new ComplexForm(objCharacter); objProgram.Create(objXmlProgram, objCharacter, objNode, strForceValue); objCharacter.ComplexForms.Add(objProgram); } // Add any Gear the Critter comes with (typically Programs for A.I.s) XmlDocument objXmlGearDocument = XmlManager.Instance.Load("gear.xml"); foreach (XmlNode objXmlGear in objXmlCritter.SelectNodes("gears/gear")) { int intRating = 0; if (objXmlGear.Attributes["rating"] != null) { intRating = Convert.ToInt32(ExpressionToString(objXmlGear.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)); } string strForceValue = ""; if (objXmlGear.Attributes["select"] != null) { strForceValue = objXmlGear.Attributes["select"].InnerText; } XmlNode objXmlGearItem = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlGear.InnerText + "\"]"); TreeNode objNode = new TreeNode(); Gear objGear = new Gear(objCharacter); List <Weapon> lstWeapons = new List <Weapon>(); List <TreeNode> lstWeaponNodes = new List <TreeNode>(); objGear.Create(objXmlGearItem, objCharacter, objNode, intRating, lstWeapons, lstWeaponNodes, strForceValue); objGear.Cost = "0"; objGear.Cost3 = "0"; objGear.Cost6 = "0"; objGear.Cost10 = "0"; objCharacter.Gear.Add(objGear); } // If this is a Mutant Critter, count up the number of Skill points they start with. if (objCharacter.MetatypeCategory == "Mutant Critters") { foreach (Skill objSkill in objCharacter.Skills) { objCharacter.MutantCritterBaseSkills += objSkill.Rating; } } // Add the Unarmed Attack Weapon to the character. try { objXmlDocument = XmlManager.Instance.Load("weapons.xml"); XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"Unarmed Attack\"]"); TreeNode objDummy = new TreeNode(); Weapon objWeapon = new Weapon(objCharacter); objWeapon.Create(objXmlWeapon, objCharacter, objDummy, null, null, null); objCharacter.Weapons.Add(objWeapon); } catch { } objCharacter.Alias = strCritterName; objCharacter.Created = true; objCharacter.Save(); string strOpenFile = objCharacter.FileName; objCharacter = null; // Link the newly-created Critter to the Spirit. _objSpirit.FileName = strOpenFile; if (_objSpirit.EntityType == SpiritType.Spirit) { tipTooltip.SetToolTip(imgLink, LanguageManager.Instance.GetString("Tip_Spirit_OpenFile")); } else { tipTooltip.SetToolTip(imgLink, LanguageManager.Instance.GetString("Tip_Sprite_OpenFile")); } FileNameChanged(this); GlobalOptions.Instance.MainForm.LoadCharacter(strOpenFile, true); }
protected IEnumerator UpdateTraps() { while (Traps.Count > 0) { //Debug.Log("Updating traps: " + Traps.Count.ToString()); for (int i = Traps.LastIndex(); i >= 0; i--) { //Debug.Log("Checking trap"); ITrap trap = Traps[i]; if (trap == null) { Traps.RemoveAt(i); } else if (trap.IsFinished || trap.Mode != TrapMode.Set) { trap.SkillUpdating = false; Traps.RemoveAt(i); } else { //okay, the trap is set and it's not finished and it has intersecting dens for (int j = trap.IntersectingDens.LastIndex(); j >= 0; j--) { ICreatureDen den = trap.IntersectingDens[j]; if (den == null || den.IsFinished) { trap.IntersectingDens.RemoveAt(j); } else if (trap.CanCatch.Count > 0 && !trap.CanCatch.Contains(den.NameOfCreature) || trap.Exceptions.Count > 0 && trap.Exceptions.Contains(den.NameOfCreature)) { //make sure this trap can actually catch what's in it trap.IntersectingDens.RemoveAt(j); } else { //is it time to check this trap yet? is the player nearby? if ((WorldClock.AdjustedRealTime - trap.TimeLastChecked) > Globals.TrappingMinimumRTCheckInterval) { bool readyToCheck = true; if (trap.RequiresMinimumPlayerDistance && Vector3.Distance(Player.Local.Position, trap.Owner.tr.position) < Globals.TrappingMinimumCorpseSpawnDistance) { readyToCheck = false; } if (readyToCheck) { trap.TimeLastChecked = WorldClock.AdjustedRealTime; //odds of catching something increases over time float oddsOfCatchingSomething = trap.SkillOnSet; double timeSinceSet = WorldClock.AdjustedRealTime - trap.TimeSet; oddsOfCatchingSomething = Mathf.Clamp01((float)(oddsOfCatchingSomething + (Globals.TrappingOddsTimeMultiplier * timeSinceSet))); //okay, figure out how close to the den we are float distanceToCenterOfDen = Vector3.Distance(trap.Owner.tr.position, den.transform.position); float distanceToDen = distanceToCenterOfDen - den.Radius; float trapRadius = Skill.SkillEffectRadius( Effects.UnskilledEffectRadius, Effects.SkilledEffectRadius, Effects.MasteredEffectRadius, trap.SkillOnSet, //this is the only difference between this & a normal skill check State.HasBeenMastered); if (trapRadius >= distanceToCenterOfDen) { //wuhoo, huge bonus odds! oddsOfCatchingSomething = Mathf.Clamp01(oddsOfCatchingSomething * Globals.TrappingOddsDistanceMultiplier); } else if (trapRadius >= distanceToDen) { //okay, no huge bonus but still cool } else { oddsOfCatchingSomething = 0f; } if (oddsOfCatchingSomething > 0f && UnityEngine.Random.value < oddsOfCatchingSomething) { Debug.Log("Caught something at creature den"); if (den.TrapsSpawnCorpse) { float timeSinceDeath = UnityEngine.Random.Range(0f, (float)timeSinceSet); den.SpawnCreatureCorpse(trap.Owner.Position + Vector3.up, "Trap", timeSinceDeath); } //the trap will take care of itself trap.OnCatchTarget(State.NormalizedMasteryLevel); //we're done with this trap until it's triggered again Traps.RemoveAt(i); } } } } } } double waitUntil = Frontiers.WorldClock.AdjustedRealTime + 1f; while (Frontiers.WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } } yield return(null); } mUpdatingTraps = false; yield break; }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0 || m_Stone.IsEmpty) { return; } Mobile from = sender.Mobile; if (!m_Stone.CheckUse(from)) { return; } if (info.ButtonID == 1) // Remove skill points { from.SendGump(new ConfirmRemovalGump(m_Stone)); return; } SkillName skill = m_Stone.Skill; double skillValue = m_Stone.SkillValue; Skill fromSkill = from.Skills[m_Stone.Skill]; /* If we have, say, 88.4 in our skill and the stone holds 100, we need * 11.6 free points. Also, if we're below our skillcap by, say, 8.2 points, * we only need 11.6 - 8.2 = 3.4 points. */ int requiredAmount = (int)(skillValue * 10) - fromSkill.BaseFixedPoint - (from.SkillsCap - from.SkillsTotal); bool cannotAbsorb = false; if (fromSkill.Lock != SkillLock.Up) { cannotAbsorb = true; } else if (requiredAmount > 0) { int available = 0; for (int i = 0; i < from.Skills.Length; ++i) { if (from.Skills[i].Lock != SkillLock.Down) { continue; } available += from.Skills[i].BaseFixedPoint; } if (requiredAmount > available) { cannotAbsorb = true; } } if (cannotAbsorb) { // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER> /* You cannot absorb the selected skill from the Soulstone at this time. The selected * skill may be locked or set to lower in your skill menu. You may also be at your * total skill cap. Click on "Skills" in your paperdoll menu to check your * raise/locked/lower settings and your total skills. Make any needed adjustments, * then click "Continue". If you do not wish to transfer the selected skill at this * time, click "Cancel". */ from.SendGump(new ErrorGump(m_Stone, 1070717, 1070716)); return; } if (skillValue > fromSkill.Cap) { // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER> /* The amount of skill stored in this stone exceeds your individual skill cap for * that skill. In order to retrieve the skill points stored in this stone, you must * obtain a Power Scroll of the appropriate type and level in order to increase your * skill cap. You cannot currently retrieve the skill points stored in this stone. */ from.SendGump(new ErrorGump(m_Stone, 1070717, 1070715)); return; } if (fromSkill.Base >= skillValue) { // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER> /* You cannot transfer the selected skill to the Soulstone at this time. The selected * skill has a skill level higher than what is stored in the Soulstone. */ // Wrong message?! from.SendGump(new ErrorGump(m_Stone, 1070717, 1070802)); return; } #region Scroll of ALacrity PlayerMobile pm = from as PlayerMobile; if (pm.AcceleratedStart > DateTime.UtcNow) { // <CENTER>Unable to Absorb Selected Skill from Soulstone</CENTER> /*You may not use a soulstone while your character is under the effects of a Scroll of Alacrity.*/ // Wrong message?! from.SendGump(new ErrorGump(m_Stone, 1070717, 1078115)); return; } #endregion if (requiredAmount > 0) { for (int i = 0; i < from.Skills.Length; ++i) { if (from.Skills[i].Lock != SkillLock.Down) { continue; } if (requiredAmount >= from.Skills[i].BaseFixedPoint) { requiredAmount -= from.Skills[i].BaseFixedPoint; from.Skills[i].Base = 0.0; } else { from.Skills[i].BaseFixedPoint -= requiredAmount; break; } } } fromSkill.Base = skillValue; m_Stone.SkillValue = 0.0; from.SendLocalizedMessage(1070713); // You have successfully absorbed the Soulstone's skill points. m_Stone.LastUserName = from.Name; Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0); Effects.PlaySound(from.Location, from.Map, 0x243); Effects.SendMovingParticles(new Entity(Server.Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100); Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100); if (m_Stone is SoulstoneFragment) { SoulstoneFragment frag = m_Stone as SoulstoneFragment; if (--frag.UsesRemaining <= 0) { from.SendLocalizedMessage(1070974); // You have used up your soulstone fragment. } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { switch ((ButtonID)info.ButtonID) { case ButtonID.NextPage: { m_Page++; break; // gump will be resent at end of OnResponse } case ButtonID.PrevPage: { m_Page--; break; // gump will be resent at end of OnResponse } case ButtonID.StrLock: { switch (m_Target.StrLock) { case StatLockType.Down: m_Target.StrLock = StatLockType.Locked; break; case StatLockType.Locked: m_Target.StrLock = StatLockType.Up; break; case StatLockType.Up: m_Target.StrLock = StatLockType.Down; break; } break; } case ButtonID.DexLock: { switch (m_Target.DexLock) { case StatLockType.Down: m_Target.DexLock = StatLockType.Locked; break; case StatLockType.Locked: m_Target.DexLock = StatLockType.Up; break; case StatLockType.Up: m_Target.DexLock = StatLockType.Down; break; } break; } case ButtonID.IntLock: { switch (m_Target.IntLock) { case StatLockType.Down: m_Target.IntLock = StatLockType.Locked; break; case StatLockType.Locked: m_Target.IntLock = StatLockType.Up; break; case StatLockType.Up: m_Target.IntLock = StatLockType.Down; break; } break; } default: { if (info.ButtonID >= (int)ButtonID.SkillLock) { int skill = info.ButtonID - (int)ButtonID.SkillLock; Skill sk = null; if (skill >= 0 && skill < m_Target.Skills.Length) { sk = m_Target.Skills[skill]; } if (sk != null) { switch (sk.Lock) { case SkillLock.Up: sk.SetLockNoRelay(SkillLock.Down); sk.Update(); break; case SkillLock.Down: sk.SetLockNoRelay(SkillLock.Locked); sk.Update(); break; case SkillLock.Locked: sk.SetLockNoRelay(SkillLock.Up); sk.Update(); break; } } } else { return; } break; } } m_User.SendGump(new AnimalLoreGump(m_Target, m_User, m_Page)); }
public int Handle(Skill skill) { return(0); }
/// <summary> /// Bolt specific use code. /// </summary> /// <param name="attacker"></param> /// <param name="skill"></param> /// <param name="target"></param> protected override void UseSkillOnTarget(Creature attacker, Skill skill, Creature target) { attacker.StopMove(); target.StopMove(); // Create actions var aAction = new AttackerAction(CombatActionType.RangeHit, attacker, target.EntityId); aAction.Set(AttackerOptions.Result); var tAction = new TargetAction(CombatActionType.TakeHit, target, attacker, skill.Info.Id); tAction.Set(TargetOptions.Result); tAction.Stun = TargetStun; var cap = new CombatActionPack(attacker, skill.Info.Id, aAction, tAction); // Damage var damage = this.GetDamage(attacker, skill); // Elements damage *= this.GetElementalDamageMultiplier(attacker, target); // Critical Hit var critChance = attacker.GetTotalCritChance(target.Protection, true); CriticalHit.Handle(attacker, critChance, ref damage, tAction); // Reduce damage SkillHelper.HandleMagicDefenseProtection(target, ref damage); SkillHelper.HandleConditions(attacker, target, ref damage); ManaShield.Handle(target, ref damage, tAction); ManaDeflector.Handle(attacker, target, ref damage, tAction); // Deal damage if (damage > 0) { target.TakeDamage(tAction.Damage = damage, attacker); } target.Aggro(attacker); // Knock down on deadly if (target.Conditions.Has(ConditionsA.Deadly)) { tAction.Set(TargetOptions.KnockDown); tAction.Stun = TargetStun; } // Death/Knockback attacker.Shove(target, KnockbackDistance); if (target.IsDead) { tAction.Set(TargetOptions.FinishingKnockDown); } else { tAction.Set(TargetOptions.KnockDown); } // Override stun set by defense aAction.Stun = AttackerStun; Send.Effect(attacker, Effect.UseMagic, EffectSkillName); Send.SkillUseStun(attacker, skill.Info.Id, aAction.Stun, 1); skill.Stacks = 0; // Update current weapon SkillHelper.UpdateWeapon(attacker, target, ProficiencyGainType.Melee, attacker.RightHand); cap.Handle(); }
void OnDisable() { skillObject = null; Skill = null; }
// Token: 0x06000020 RID: 32 RVA: 0x00002A90 File Offset: 0x00000C90 public static ImbueEffectPreset MakeImbuePreset(int imbueID, string name, string description, string iconFileName, int visualEffectID, float flatDamage, float scalingDamage, DamageType.Types damageType, string statusEffect, Skill skill, int chanceToContract = 0, int buildUp = 0) { Dictionary <int, EffectPreset> dictionary = (Dictionary <int, EffectPreset>)At.GetValue(typeof(ResourcesPrefabManager), null, "EFFECTPRESET_PREFABS"); bool flag = !dictionary.ContainsKey(imbueID); ImbueEffectPreset result; if (flag) { GameObject gameObject = new GameObject(imbueID.ToString() + "_" + name.Replace(" ", "")); gameObject.SetActive(true); UnityEngine.Object.DontDestroyOnLoad(gameObject); ImbueEffectPreset imbueEffectPreset = gameObject.AddComponent <ImbueEffectPreset>(); imbueEffectPreset.name = imbueID.ToString() + "_" + name.Replace(" ", ""); At.SetValue <int>(imbueID, typeof(EffectPreset), imbueEffectPreset, "m_StatusEffectID"); At.SetValue <string>(name, typeof(ImbueEffectPreset), imbueEffectPreset, "m_imbueNameKey"); At.SetValue <string>(description, typeof(ImbueEffectPreset), imbueEffectPreset, "m_imbueDescKey"); imbueEffectPreset.ImbueStatusIcon = ((ImbueEffectPreset)dictionary[visualEffectID]).ImbueStatusIcon; imbueEffectPreset.ImbueFX = ((ImbueEffectPreset)dictionary[visualEffectID]).ImbueFX; TinyEffectManager.SetNameAndDesc(imbueEffectPreset, name, description); dictionary.Add(imbueID, imbueEffectPreset); GameObject gameObject2 = new GameObject("Effects"); gameObject2.SetActive(true); UnityEngine.Object.DontDestroyOnLoad(gameObject2); gameObject2.transform.SetParent(imbueEffectPreset.transform); bool flag2 = statusEffect != null && chanceToContract > 0; if (flag2) { TinyEffectManager.AddStatusEffectChance(imbueEffectPreset, chanceToContract, statusEffect); } bool flag3 = statusEffect != null && buildUp > 0; if (flag3) { TinyEffectManager.AddStatusEffectBuildUp(imbueEffectPreset, (float)buildUp, statusEffect); } bool flag4 = scalingDamage > 0f || flatDamage > 0f; if (flag4) { TinyEffectManager.AddWeaponDamage(imbueEffectPreset, flatDamage, scalingDamage, damageType); } bool flag5 = skill != null; if (flag5) { skill.GetComponentInChildren <ImbueWeapon>().ImbuedEffect = imbueEffectPreset; } result = imbueEffectPreset; } else { result = null; } return(result); }
public SkillControl2(Skill skill) { _skill = skill; InitializeComponent(); SuspendLayout(); foreach (ToolStripItem objItem in cmsSkillLabel.Items) { LanguageManager.TranslateToolStripItemsRecursively(objItem, GlobalOptions.Language); } DataBindings.Add("Enabled", skill, nameof(Skill.Enabled), false, DataSourceUpdateMode.OnPropertyChanged); //Display if (!skill.Default) { _italicName = new Font(lblName.Font, FontStyle.Italic); lblName.Font = _italicName; } if (!string.IsNullOrWhiteSpace(_skill.Notes)) { lblName.ForeColor = Color.SaddleBrown; } lblName.DataBindings.Add("Text", skill, nameof(Skill.DisplayName)); _attributeActive = skill.AttributeObject; _skill.PropertyChanged += Skill_PropertyChanged; _skill.CharacterObject.AttributeSection.PropertyChanged += AttributeSection_PropertyChanged; Skill_PropertyChanged(null, null); //if null it updates all _normal = btnAttribute.Font; _italic = new Font(_normal, FontStyle.Italic); if (skill.CharacterObject.Created) { lblModifiedRating.Location = new Point(256 - 13, 4); lblCareerRating.DataBindings.Add("Text", skill, nameof(Skill.Rating), false, DataSourceUpdateMode.OnPropertyChanged); lblCareerRating.Visible = true; btnCareerIncrease.Visible = true; btnCareerIncrease.DataBindings.Add("Enabled", skill, nameof(Skill.CanUpgradeCareer), false, DataSourceUpdateMode.OnPropertyChanged); nudSkill.Visible = false; nudKarma.Visible = false; chkKarma.Visible = false; cboSpec.Visible = false; btnAddSpec.DataBindings.Add("Enabled", skill, nameof(Skill.CanAffordSpecialization), false, DataSourceUpdateMode.OnPropertyChanged); lblCareerSpec.Visible = true; lblCareerSpec.DataBindings.Add("Text", skill, nameof(Skill.DisplaySpecialization), false, DataSourceUpdateMode.OnPropertyChanged); lblAttribute.Visible = false; //Was true, cannot think it should be btnAttribute.DataBindings.Add("Text", skill, nameof(Skill.DisplayAttribute)); btnAttribute.Visible = true; SetupDropdown(); } else { lblAttribute.DataBindings.Add("Text", skill, nameof(Skill.DisplayAttribute)); //Up down boxes nudKarma.DataBindings.Add("Value", skill, nameof(Skill.Karma), false, DataSourceUpdateMode.OnPropertyChanged); nudSkill.DataBindings.Add("Value", skill, nameof(Skill.Base), false, DataSourceUpdateMode.OnPropertyChanged); nudSkill.DataBindings.Add("Visible", skill.CharacterObject, nameof(skill.CharacterObject.BuildMethodHasSkillPoints), false, DataSourceUpdateMode.OnPropertyChanged); nudSkill.DataBindings.Add("Enabled", skill, nameof(Skill.BaseUnlocked), false, DataSourceUpdateMode.OnPropertyChanged); nudSkill.DataBindings.Add("InterceptMouseWheel", skill.CharacterObject.Options, nameof(CharacterOptions.InterceptMode), false, DataSourceUpdateMode.OnPropertyChanged); nudKarma.DataBindings.Add("Enabled", skill, nameof(Skill.KarmaUnlocked), false, DataSourceUpdateMode.OnPropertyChanged); nudKarma.DataBindings.Add("InterceptMouseWheel", skill.CharacterObject.Options, nameof(CharacterOptions.InterceptMode), false, DataSourceUpdateMode.OnPropertyChanged); chkKarma.DataBindings.Add("Visible", skill.CharacterObject, nameof(skill.CharacterObject.BuildMethodHasSkillPoints), false, DataSourceUpdateMode.OnPropertyChanged); chkKarma.DataBindings.Add("Checked", skill, nameof(Skill.BuyWithKarma), false, DataSourceUpdateMode.OnPropertyChanged); chkKarma.DataBindings.Add("Enabled", skill, nameof(Skill.CanHaveSpecs), false, DataSourceUpdateMode.OnPropertyChanged); cboSpec.BeginUpdate(); if (skill.IsExoticSkill) { cboSpec.Enabled = false; cboSpec.DataBindings.Add("Text", skill, nameof(Skill.DisplaySpecialization), false, DataSourceUpdateMode.OnPropertyChanged); } else { //dropdown/spec cboSpec.DisplayMember = nameof(ListItem.Name); cboSpec.ValueMember = nameof(ListItem.Value); cboSpec.DataBindings.Add("Enabled", skill, nameof(Skill.CanHaveSpecs), false, DataSourceUpdateMode.OnPropertyChanged); cboSpec.SelectedIndex = -1; cboSpec.DataSource = skill.CGLSpecializations; cboSpec.DataBindings.Add("Text", skill, nameof(Skill.Specialization), false, DataSourceUpdateMode.OnPropertyChanged); } cboSpec.EndUpdate(); } //Delete button if (skill.AllowDelete) { cmdDelete.Visible = true; cmdDelete.Click += (sender, args) => { skill.UnbindSkill(); skill.CharacterObject.SkillsSection.Skills.Remove(skill); skill.CharacterObject.SkillsSection.SkillsDictionary.Remove(skill.IsExoticSkill ? skill.Name + " (" + skill.DisplaySpecializationMethod(GlobalOptions.Language) + ')' : skill.Name); }; if (skill.CharacterObject.Created) { btnAddSpec.Location = new Point(btnAddSpec.Location.X - cmdDelete.Width, btnAddSpec.Location.Y); } } ResumeLayout(); }
/// <inheritdoc/> public void ShowSkillAnimation(Player attackingPlayer, IAttackable target, Skill skill) { this.clientProxy.SendAsync("ShowSkillAnimation", attackingPlayer, target, skill); }
protected bool IsReasonToUse(SkillSettings settings, Skill skill) { IRoutine routine = Core.Routines.CurrentRoutine; if (settings.Reasons.HasFlag(UseReasons.Elites) && TargetUtil.AnyElitesInRange(40f)) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Trash) && TargetUtil.ClusterExists(routine.TrashRange, routine.TrashRange, routine.ClusterSize)) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Surrounded) && TargetUtil.NumMobsInRange(25f) >= Math.Max(ClusterSize, 5)) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Avoiding) && IsCurrentlyAvoiding) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Blocked) && PlayerMover.IsBlocked) { return(true); } if (settings.Reasons.HasFlag(UseReasons.DumpResource) && Player.PrimaryResourcePct < 0.8f) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Goblins) && WeightedUnits.Any(u => u.IsTreasureGoblin)) { return(true); } if (settings.Reasons.HasFlag(UseReasons.HealthEmergency) && Player.CurrentHealthPct < TrinityCombat.Routines.Current.EmergencyHealthPct) { return(true); } if (settings.Reasons.HasFlag(UseReasons.Buff) && settings.BuffCondition != null && settings.BuffCondition()) { return(true); } return(false); }
public static void Gain(Mobile from, Skill skill) { if (from.Region.IsPartOf(typeof(Regions.Jail))) { return; } if (from is BaseCreature && ((BaseCreature)from).IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { int toGain = 1; if (skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } Skills skills = from.Skills; if (from.Player && (skills.Total / skills.Cap) >= Utility.RandomDouble())//( skills.Total >= skills.Cap ) { for (int i = 0; i < skills.Length; ++i) { Skill toLower = skills[i]; if (toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain) { toLower.BaseFixedPoint -= toGain; break; } } } #region Mondain's Legacy if (from is PlayerMobile) { if (Server.Engines.Quests.QuestHelper.EnhancedSkill((PlayerMobile)from, skill)) { toGain *= Utility.RandomMinMax(2, 4); } } #endregion #region Scroll of Alacrity PlayerMobile pm = from as PlayerMobile; if (from is PlayerMobile) { if (pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow) { pm.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. toGain = Utility.RandomMinMax(2, 5); } } #endregion if (!from.Player || (skills.Total + toGain) <= skills.Cap) { skill.BaseFixedPoint += toGain; } } #region Mondain's Legacy if (from is PlayerMobile) { Server.Engines.Quests.QuestHelper.CheckSkill((PlayerMobile)from, skill); } #endregion if (skill.Lock == SkillLock.Up) { SkillInfo info = skill.Info; if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Str); } else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Dex); } else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Int); } } }
/// <inheritdoc/> public void ShowAreaSkillAnimation(Player player, Skill skill, byte x, byte y, byte rotation) { this.clientProxy.SendAsync("ShowAreaSkillAnimation", player.Id, skill.SkillID, x, y, rotation); }
public virtual void SendConfirmMessage(Mobile from, Mobile target, Skill skill) { from.SendMessage("Your skill in {0} has been raised by {1}", skill.Name, m_SkillBonus); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from == null || m_ArmsLoreSkillScroll.Deleted) { return; } if (m_ArmsLoreSkillScroll.Expires && DateTime.UtcNow >= m_ArmsLoreSkillScroll.ExpireDate) { m_ArmsLoreSkillScroll.SendLocalizedMessageTo(from, 1042544); // This item is out of charges. } else if (!m_ArmsLoreSkillScroll.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (info.ButtonID == 1) { SkillName skillname = (m_ArmsLoreSkillScroll.GetAllowedSkills())[info.ButtonID - 1]; m_Skill = m_Target.Skills[skillname]; if (m_Skill == null) { return; } double count = m_Target.Skills.Total / 10; double cap = m_Target.SkillsCap / 10; double decreaseamount; int bonus = m_ArmsLoreSkillScroll.SkillBonus; List <Skill> decreased = m_ArmsLoreSkillScroll.GetDecreasableSkills(from, m_Target, count, cap, out decreaseamount); if (decreased.Count > 0 && decreaseamount <= 0) { from.SendMessage("You have exceeded the skill cap and do not have a skill set to be decreased."); } else if (m_ArmsLoreSkillScroll.NewbieBall && m_Skill.Base > 0) { from.SendMessage("You may only choose skills which are at zero."); } else if ((m_Skill.Base + bonus) > m_Skill.Cap) { from.SendMessage("Your skill is too high to raise it further."); } else if (m_Skill.Lock != SkillLock.Up) { from.SendMessage("You must set the skill to be increased in order to raise it further."); } else { if ((cap - count + decreaseamount) >= bonus) { m_ArmsLoreSkillScroll.DecreaseSkills(from, m_Target, decreased, count, cap, decreaseamount); m_ArmsLoreSkillScroll.IncreaseSkill(from, m_Target, m_Skill); if (!m_ArmsLoreSkillScroll.Rechargable) { m_ArmsLoreSkillScroll.Delete(); } } else { from.SendMessage("You have exceeded the skill cap and do not have enough skill set to be decreased."); } } } }
public virtual void IncreaseSkill(Mobile from, Mobile target, Skill skill) { skill.Base += m_SkillBonus; SendConfirmMessage(from, target, skill); m_SkillBonus = 0; }
public Sneak(Skill skill) : base(skill) { _skill = skill; }