//private static readonly ILogger log = LogManager.GetCurrentClassLogger(); public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { //log.Info("USE 3E9"); info = new Hashtable(); float decreaseSpeedPercent = skill.data.Inputs.Value <float>("decrease_speed_pc"); float dmgMult = skill.data.Inputs.Value <float>("dmg_mult"); string id = source.Id + skill.data.Id; info.SetSkillUseState(SkillUseState.normal); if (!CheckForShotEnemy(source, skill)) { info.SetSkillUseState(SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(SkillUseState.tooFar); return(false); } if (RollMastery(source)) { dmgMult *= 2; } WeaponHitInfo hit; var sourceWeapon = source.Weapon(); var targetBonuses = source.Target().targetObject.Bonuses(); var shotInfo = sourceWeapon.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { //log.Info("HIT ALLOWED"); float speedCount = source.GetComponent <MovableObject>().normalSpeed *decreaseSpeedPercent; Buff speedDebuff = new Buff(id, null, BonusType.decrease_speed_on_cnt, skill.data.Durability, speedCount); targetBonuses.SetBuff(speedDebuff, source); source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo); return(true); } else { log.Info("HIT NOT ALLOWED"); source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo); log.InfoFormat("Skill {0} error: hit to target not allowed", skill.data.Id.ToString("X8")); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var targetObject = source.Target().targetObject; var sourceWeapon = source.Weapon(); var sourceMessage = source.MmoMessage(); float dmgMult = skill.GetFloatInput("dmg_mult"); float dmgAreaMult = skill.GetFloatInput("dmg_area_mult"); float radius = skill.GetFloatInput("radius"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; dmgAreaMult *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); var items = GetTargets(source, targetObject, radius); foreach (var pItem in items) { var item = pItem.Value; WeaponHitInfo hit2; var shot2 = sourceWeapon.Fire(item, out hit2, skill.data.Id, dmgAreaMult); if (hit2.normalOrMissed) { sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot2); } } return(true); } else { sourceMessage.SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } float dmgMult = skill.GetFloatInput("dmg_mult"); float blockProb = skill.GetFloatInput("block_prob"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; blockProb *= 2; } WeaponHitInfo hit; var shot = source.Weapon().Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { var targetWeapon = source.Target().targetObject.Weapon(); if (targetWeapon) { if (Rand.Float01() < blockProb) { targetWeapon.BlockSingleShot(); } } source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var targetObject = source.Target().targetObject; var sourceWeapon = source.Weapon(); var sourceBonuses = source.Bonuses(); WeaponHitInfo hit; float dmgMult = skill.GetFloatInput("dmg_mult"); float speedPc = skill.GetFloatInput("speed_pc"); float speedTime = skill.GetFloatInput("speed_time"); float radius = skill.GetFloatInput("radius"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; speedTime *= 2; } var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); var items = GetTargets(source, targetObject, radius); foreach (var pItem in items) { var item = pItem.Value; var itemBonuses = item.Bonuses(); Buff speedDebuff = new Buff(skill.id, null, Common.BonusType.decrease_speed_on_pc, speedTime, speedPc); itemBonuses.SetBuff(speedDebuff, source); } return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } float dmgMult = skill.GetFloatInput("dmg_mult"); float dmgPc = skill.GetFloatInput("dmg_pc"); float dmgTime = skill.GetFloatInput("dmg_time"); var sourceWeapon = source.Weapon(); var targetObject = source.Target().targetObject; var targetBonuses = targetObject.Bonuses(); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; dmgTime *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.decrease_damage_on_pc, dmgTime, dmgPc); targetBonuses.SetBuff(buff, source); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); var sourceTarget = source.Target(); if (!sourceTarget.inCombat && sourceTarget.noSubscribers) { source.SetInvisibility(true); //var sourceShip = source.GetComponent<PlayerShip>(); //if(sourceShip != null ) { // sourceShip.SetInvisTimer(10); //} return(true); } return(false); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); var sourceTarget = source.Target(); bool settedOnTarget = false; float time = skill.GetFloatInput("time"); bool mastery = RollMastery(source); if (mastery) { time *= 2; } if (sourceTarget.targetObject) { var targetCharacter = sourceTarget.targetObject.Character(); if (targetCharacter) { var sourceCharacter = source.Character(); if (sourceCharacter.RelationTo(targetCharacter) == Common.FractionRelation.Friend) { var sourceWeapon = source.Weapon(); if (source.transform.DistanceTo(sourceTarget.targetObject.transform) <= sourceWeapon.optimalDistance) { var targetBonuses = sourceTarget.targetObject.Bonuses(); if (targetBonuses) { Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.speed_debuff_immunity, time); targetBonuses.SetBuff(buff, source); settedOnTarget = true; } } } } } if (!settedOnTarget) { Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.speed_debuff_immunity, time); source.Bonuses().SetBuff(buff, source); } return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } var targetObject = source.Target().targetObject; var sourceWeapon = source.Weapon(); var sourceBonuses = source.Bonuses(); WeaponHitInfo hit; float dmgMult = skill.GetFloatInput("dmg_mult"); float hpPc = skill.GetFloatInput("hp_pc"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; hpPc *= 2; } var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { sourceWeapon.Heal(source, source.Damagable().maximumHealth *hpPc); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var sourceWeapon = source.Weapon(); var targetObject = source.Target().targetObject; float damageMult = skill.GetFloatInput("dmg_mult"); bool mastery = RollMastery(source); if (mastery) { damageMult *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, damageMult); if (hit.normalOrMissed) { Vector3 center = (source.transform.position + targetObject.transform.position) * 0.5f; float radius = source.transform.DistanceTo(targetObject.transform) * 0.5f; var skillComponent = source.GetComponent <Skill_0000045E_Component>(); if (skillComponent == null) { skillComponent = source.AddComponent <Skill_0000045E_Component>(); } skillComponent.SetSkill(center, radius, skill.data); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } float speedPc = skill.GetFloatInput("speed_pc"); float speedTime = skill.GetFloatInput("speed_time"); var target = source.Target().targetObject; var targetMovable = target.Movable(); if (!targetMovable) { return(false); } bool mastery = RollMastery(source); if (mastery) { speedTime *= 2; info.SetMastery(true); } else { info.SetMastery(false); } Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.decrease_speed_on_pc, speedTime, speedPc); target.Bonuses().SetBuff(buff, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (ShotToEnemyRestricted(source, skill)) { return(false); } var targetObject = source.Target().targetObject; var sourceShip = source.GetComponent <BaseShip>(); var targetShip = targetObject.GetComponent <BaseShip>(); if ((!sourceShip) || (!targetShip)) { return(false); } var sourceBonuses = source.Bonuses(); var targetBonuses = targetObject.Bonuses(); float time = skill.GetFloatInput("time"); bool mastery = RollMastery(source); if (mastery) { time *= 2; } //decrated skill do nothing (only for icons) Buff sourceDebuff = new Buff(skill.id, null, Common.BonusType.block_resist, time); sourceBonuses.SetBuff(sourceDebuff, source); sourceShip.BlockResist(time); //decorated skill do nothing (only for icons) Buff targetDebuff = new Buff(skill.id, null, Common.BonusType.block_resist, time); targetBonuses.SetBuff(targetDebuff, source); targetShip.BlockResist(time); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var sourceWeapon = source.Weapon(); var targetObject = source.Target().targetObject; var targetBonuses = targetObject.Bonuses(); float dmgMult = skill.GetFloatInput("dmg_mult"); float hpPc = skill.GetFloatInput("hp_pc"); float hpTime = skill.GetFloatInput("hp_time"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; hpTime *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { Buff buff = new Buff(skill.id, null, Common.BonusType.decrease_max_hp_on_pc, hpTime, hpPc); targetBonuses.SetBuff(buff, source); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var sourceWeapon = source.Weapon(); var targetObject = source.Target().targetObject; var targetDamagable = targetObject.Damagable(); var sourceMessage = source.MmoMessage(); float dmgMult = skill.GetFloatInput("dmg_mult"); float timedDmgMult = skill.GetFloatInput("timed_dmg_mult"); float timedDmgTime = skill.GetFloatInput("dmg_time"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { var timedDamage = sourceWeapon.GenerateDamage().totalDamage *timedDmgMult / timedDmgTime; targetDamagable.SetTimedDamage(timedDmgTime, timedDamage, sourceWeapon.myWeaponBaseType, skill.idInt); sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } else { sourceMessage.SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } float speedPc = skill.GetFloatInput("speed_pc"); float speedTime = skill.GetFloatInput("speed_time"); float dmgPc = skill.GetFloatInput("dmg_pc"); bool mastery = RollMastery(source); if (mastery) { dmgPc *= 2; speedPc *= 2; } var sourceWeapon = source.Weapon(); var targetObject = source.Target().targetObject; var targetBonuses = targetObject.Bonuses(); Buff speedDebuff = new Buff(skill.id, null, Common.BonusType.decrease_speed_on_pc, speedTime, speedPc); targetBonuses.SetBuff(speedDebuff, source); var targetDamagable = targetObject.Damagable(); float damage = sourceWeapon.GenerateDamage().totalDamage *dmgPc; targetDamagable.SetTimedDamage(speedTime, damage, sourceWeapon.myWeaponBaseType, skill.idInt); info.Add((int)SPC.Damage, damage); source.SetInvisibility(false); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } var targetObject = source.Target().targetObject; var targetBonuses = targetObject.Bonuses(); var sourceMovable = source.Movable(); float speedPc = skill.GetFloatInput("speed_pc"); float speedTime = skill.GetFloatInput("time"); float speedValue = sourceMovable.maximumSpeed * speedPc; bool mastery = RollMastery(source); if (mastery) { speedTime *= 2; } Buff targetBuff = new Buff(skill.id, null, Common.BonusType.decrease_speed_on_cnt, speedTime, speedValue); targetBonuses.SetBuff(targetBuff, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); var targetObject = source.Target().targetObject; if (!targetObject) { return(false); } var weapon = source.Weapon(); if (Mathf.Approximately(weapon.HitProbTo(targetObject), 0f)) { log.InfoFormat("Skill {0} error: hit prob is 0", skill.data.Id.ToString("X8")); return(false); } float dmgMult = skill.GetFloatInput("dmg_mult"); float critChanceForBot = skill.GetFloatInput("crit_chance"); float maxCrit = skill.GetFloatInput("max_crit"); float time = skill.GetFloatInput("time"); float radius = skill.GetFloatInput("radius"); var character = source.Character(); var targets = source.mmoWorld().GetItems((item) => { var damagable = item.Damagable(); var itemCharacter = item.Character(); if (damagable && itemCharacter) { var relation = character.RelationTo(itemCharacter); if (relation == FractionRelation.Enemy || relation == FractionRelation.Neutral) { if (targetObject.transform.DistanceTo(item.transform) <= radius) { return(true); } } } return(false); }); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; time *= 2; } foreach (var pTarget in targets) { WeaponHitInfo hit; var shot = weapon.Fire(pTarget.Value, out hit, skill.data.Id, dmgMult, forceShot: true); source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shot); } float critChanceBuffValue = Mathf.Clamp(targets.Count * critChanceForBot, 0, maxCrit); if (!Mathf.Approximately(0f, critChanceBuffValue)) { Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_crit_chance_on_cnt, time, critChanceBuffValue); source.Bonuses().SetBuff(buff, source); } return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } float dmgMult = skill.GetFloatInput("dmg_mult"); float dmgAreaMult = skill.GetFloatInput("dmg_area_mult"); float dmgPc = skill.GetFloatInput("dmg_pc"); float dmgTime = skill.GetFloatInput("dmg_time"); int stackCount = skill.GetIntInput("stack_count"); float radius = skill.GetFloatInput("radius"); var sourceWeapon = source.Weapon(); var sourceBonuses = source.Bonuses(); var sourceMessage = source.MmoMessage(); var sourceCharacter = source.Character(); var sourceRace = source.Raceable(); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; dmgAreaMult *= 2; dmgTime *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); var genDmg = sourceWeapon.GenerateDamage(); genDmg.Mult(dmgAreaMult); InputDamage inpDamage = new InputDamage(source, genDmg); foreach (var pTarget in GetTargets(source, source.Target().targetObject, radius)) { pTarget.Value.Damagable().ReceiveDamage(inpDamage); if (sourceBonuses.GetBuffCountWithTag(Common.BonusType.increase_damage_on_pc, skill.data.Id) < stackCount) { Buff buff = new Buff(Guid.NewGuid().ToString(), null, Common.BonusType.increase_damage_on_pc, dmgTime, dmgPc); buff.SetTag(skill.data.Id); sourceBonuses.SetBuff(buff, source); } } return(true); } else { sourceMessage.SendShot(Common.EventReceiver.ItemOwner, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); log.InfoFormat("43F used.."); var sourceWeapon = source.Weapon(); var sourceCharacter = source.Character(); var targetObject = source.Target().targetObject; if (!targetObject) { log.InfoFormat("no target..."); return(false); } var targetBonuses = targetObject.Bonuses(); if (!targetBonuses) { log.InfoFormat("no bonuses on target..."); return(false); } var targetCharacter = targetObject.Character(); if (!targetCharacter) { log.InfoFormat("no character on target..."); return(false); } var targetDamagable = targetObject.Damagable(); if (!targetDamagable) { log.InfoFormat("no damagable on target..."); return(false); } var relation = sourceCharacter.RelationTo(targetCharacter); if (!(relation == Common.FractionRelation.Enemy || relation == Common.FractionRelation.Neutral)) { log.InfoFormat("relation invalid = {0}", relation); return(false); } float odMult = skill.GetFloatInput("od_mult"); bool mastery = RollMastery(source); if (mastery) { odMult *= 2; } float distanceToTarget = source.transform.DistanceTo(targetObject.transform); float limitDistance = sourceWeapon.optimalDistance * odMult; log.InfoFormat("distance to target = {0}, limit distance = {1}", distanceToTarget, limitDistance); if (distanceToTarget > limitDistance) { return(false); } var direction = source.transform.DirectionTo(targetObject.transform) * sourceWeapon.optimalDistance * 0.05f; var newPos = source.transform.position + direction; if (targetObject.IsPlayer()) { targetObject.MmoMessage().SetPos(newPos); } else { (targetObject as Item).Move(new GameMath.Vector { X = newPos.X, Y = newPos.Y, Z = newPos.Z }); } return(true); }
/// <summary> /// Now this stun skill /// </summary> /// <param name="source">Source who cast</param> /// <param name="skill">Skill was used</param> /// <param name="info">Returned cast info</param> /// <returns>Status of cast using</returns> public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); return(false); } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } } float time = skill.GetFloatInput("time"); bool mastery = RollMastery(source); if (mastery) { time *= 2.0f; info.SetMastery(true); } else { info.SetMastery(false); } source.Target().targetObject.Bonuses().SetBuff(new Buff(skill.id, null, Common.BonusType.stun, time, 1.0f), source); return(true); /* * info.SetSkillUseState(Common.SkillUseState.normal); * if(!CheckForHealAlly(source)) { * info.SetSkillUseState(Common.SkillUseState.invalidTarget); * return false; * } * if(NotCheckDistance(source)) { * info.SetSkillUseState(Common.SkillUseState.tooFar); * return false; * } * * float hpPc = skill.GetFloatInput("hp_pc"); * * var targetObject = source.Target().targetObject; * var targetDamagable = targetObject.Damagable(); * float restoreHP = targetDamagable.maximumHealth * hpPc; * * var weapon = source.Weapon(); * * bool mastery = RollMastery(source); * if(mastery) { * restoreHP *= 2; * } * * var heal = weapon.Heal(targetObject, restoreHP, skill.data.Id); * source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); * * var targetEnergy = targetObject.GetComponent<ShipEnergyBlock>(); * if(targetEnergy ) { * float restoredEnergy = hpPc * targetEnergy.maximumEnergy; * if(mastery) { * restoredEnergy *= 2; * } * targetEnergy.RestoreEnergy(restoredEnergy); * }*/ }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); bool castOnTarget = true; if (source.Target().hasTarget) { if (FriendTargetInvalid(source)) { castOnTarget = false; } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } } } else { castOnTarget = false; } float time = skill.GetFloatInput("time"); bool mastery = RollMastery(source); if (mastery) { time *= 2; info.SetMastery(true); } else { info.SetMastery(false); } string id = GetBuffId(skill, source); if (castOnTarget) { var sourceTarget = source.Target(); sourceTarget.targetObject.Bonuses().SetBuff(new Buff(id, null, Common.BonusType.block_debuff, time, 1), source); info.Add((int)SPC.Target, sourceTarget.targetId); info.Add((int)SPC.TargetType, sourceTarget.targetType); } else { source.Bonuses().SetBuff(new Buff(id, null, Common.BonusType.block_debuff, time, 1), source); info.Add((int)SPC.Target, source.Id); info.Add((int)SPC.TargetType, source.Type); } /* * if(!CheckForShotFriend(source, skill)) { * return false; * } * * var targetBonuses = source.GetComponent<PlayerTarget>().targetObject.GetComponent<PlayerBonuses>(); * targetBonuses.RemoveBuffs(Common.BonusType.decrease_resist_on_cnt); * targetBonuses.RemoveBuffs(Common.BonusType.decrease_resist_on_pc);*/ return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); bool castOnTarget = true; if (source.Target().hasTarget) { if (FriendTargetInvalid(source)) { castOnTarget = false; } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } } } else { castOnTarget = false; } float radius = skill.GetFloatInput("radius"); float healMult = skill.GetFloatInput("heal_mult"); float dmgMult = skill.GetFloatInput("dmg_mult"); bool mastery = RollMastery(source); if (mastery) { healMult *= 2; dmgMult *= 2; info.SetMastery(true); } else { info.SetMastery(false); } NebulaObject enemyCenterObj = null; float healVal = source.Weapon().GetDamage().totalDamage; if (castOnTarget) { var tObj = source.Target().targetObject; var heal = source.Weapon().Heal(tObj, healMult * healVal, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); var nearestFriend = GetNearestFriend(tObj, source, radius); info.Add((int)SPC.Var1, new Hashtable { { (int)SPC.ItemId, tObj.Id }, { (int)SPC.ItemType, tObj.Type } }); if (nearestFriend != null) { heal = source.Weapon().Heal(nearestFriend, healMult * healVal, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); info.Add((int)SPC.Var2, new Hashtable { { (int)SPC.ItemId, nearestFriend.Id }, { (int)SPC.ItemType, nearestFriend.Type } }); } enemyCenterObj = source.Target().targetObject; } else { var heal = source.Weapon().HealSelf(healVal, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); info.Add((int)SPC.Var1, new Hashtable { { (int)SPC.ItemId, source.Id }, { (int)SPC.ItemType, source.Type } }); var nearestFriend = GetNearestFriend(source, source, radius); if (nearestFriend != null) { heal = source.Weapon().Heal(nearestFriend, healMult * healVal, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); info.Add((int)SPC.Var2, new Hashtable { { (int)SPC.ItemId, nearestFriend.Id }, { (int)SPC.ItemType, nearestFriend.Type } }); } enemyCenterObj = source; } var sWeapon = source.Weapon(); var sMessage = source.MmoMessage(); foreach (var enemy in GetNearestEnemies(enemyCenterObj, source, radius)) { WeaponHitInfo hit; var fire = sWeapon.Fire(enemy.Value, out hit, skill.idInt, dmgMult); sMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, fire); log.InfoFormat("send fire to object {0}->{1}".Olive(), enemy.Value.Id, enemy.Value.getItemType()); } //var weapon = source.Weapon(); //var message = source.MmoMessage(); //var targetObject = source.Target().targetObject; //var healValue = weapon.GetDamage(false).totalDamage * healMult; //var firstHeal = weapon.Heal(targetObject, healValue, skill.data.Id); //message.SendHeal(Common.EventReceiver.OwnerAndSubscriber, firstHeal); //var healTargets = GetHealTargets(source, targetObject, radius); //foreach(var pHealTarget in healTargets) { // var secondHeal = weapon.Heal(pHealTarget.Value, healValue, skill.data.Id); // message.SendHeal(Common.EventReceiver.OwnerAndSubscriber, secondHeal); // break; //} //var dmgTargets = GetTargets(source, targetObject, radius); //foreach(var pDmgTarget in dmgTargets) { // WeaponHitInfo hit; // var shot = weapon.Fire(pDmgTarget.Value, out hit, skill.data.Id, dmgMult); // message.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); //} return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } var targ = source.Target().targetObject; var sourceCharacter = source.Character(); var sourceWeapon = source.Weapon(); var message = source.GetComponent <MmoMessageComponent>(); float dmgMult = skill.GetFloatInput("dmg_mult"); float radius = skill.GetFloatInput("radius"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; radius *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); BonusType[] speedDebuffs = BuffUtils.GetDebuffsForParameter(BuffParameter.speed); if (hit.normalOrMissed) { message.SendShot(EventReceiver.OwnerAndSubscriber, shot); var items = source.mmoWorld().GetItems((item) => { var itemBonuses = item.Bonuses(); var itemCharacter = item.Character(); var itemDamagable = item.Damagable(); bool allComponentPresent = itemBonuses && itemCharacter && itemDamagable; if (allComponentPresent) { if (item.Id != targ.Id) { float distanceToTarg = targ.transform.DistanceTo(item.transform); if (distanceToTarg <= radius) { if (itemBonuses.ContainsAny(speedDebuffs)) { var relation = sourceCharacter.RelationTo(itemCharacter); if (relation == FractionRelation.Enemy || relation == FractionRelation.Neutral) { return(true); } } } } } return(false); }); foreach (var pitem in items) { WeaponHitInfo itemHit; var itemShot = sourceWeapon.Fire(pitem.Value, out itemHit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { message.SendShot(EventReceiver.OwnerAndSubscriber, itemShot); } else { message.SendShot(EventReceiver.OwnerAndSubscriber, shot); } } return(true); } else { source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shot); return(false); } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(SkillUseState.tooFar); return(false); } var sourceWeapon = source.Weapon(); var sourceTarget = source.Target(); var targetBonuses = sourceTarget.targetObject.Bonuses(); if (!sourceTarget) { return(false); } if (!sourceTarget.targetObject) { return(false); } var targetShip = sourceTarget.targetObject.GetComponent <BaseShip>(); if (!targetShip) { return(false); } float targetResistance = sourceTarget.targetObject.GetComponent <BaseShip>().commonResist; float dmgMult = skill.GetFloatInput("dmg_mult"); float resistTime = skill.GetFloatInput("resist_time"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; resistTime *= 2; info.SetMastery(true); } else { info.SetMastery(false); } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { Buff resistDebuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.decrease_resist_on_cnt, resistTime, targetResistance); targetBonuses.SetBuff(resistDebuff, source); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); return(true); } return(false); }
protected bool NotCheckDistance(NebulaObject source) { return(source.Weapon().BlockedByDistance(source.Target().targetObject)); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); float dmgMult = skill.GetFloatInput("dmg_mult"); float dmgTimedMult = skill.GetFloatInput("dmg_timed_mult"); float time = skill.GetFloatInput("time"); var sourceCharacter = source.Character(); var sourceRaceable = source.Raceable(); info.SetSkillUseState(SkillUseState.normal); if (ShotToEnemyRestricted(source, skill)) { info.SetSkillUseState(SkillUseState.invalidTarget); return(false); } if (NotCheckDistance(source)) { info.SetSkillUseState(SkillUseState.tooFar); return(false); } WeaponHitInfo hit; var sourceWeapon = source.Weapon(); float baseDamage = sourceWeapon.GetDamage().totalDamage; float timedDamage = baseDamage * dmgTimedMult; //float secondDamage = baseDamage * dmgAreaMult; bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; timedDamage *= 2; info.SetMastery(true); } else { info.SetMastery(false); } var shot = source.Weapon().Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); source.Target().targetObject.Damagable().SetTimedDamage(time, timedDamage / time, sourceWeapon.myWeaponBaseType, skill.idInt); /* * WeaponDamage sInpWeapDmg = new WeaponDamage(sourceWeapon.myWeaponBaseType); * sInpWeapDmg.SetBaseTypeDamage(secondDamage); * InputDamage inpDamage = new InputDamage(source, sInpWeapDmg); * if(mastery) { * inpDamage.Mult(2); * //inpDamage.SetDamage(inpDamage.damage * 2); * } * foreach(var pitem in GetTargets(source, source.Target().targetObject, radius)) { * pitem.Value.Damagable().ReceiveDamage(inpDamage); * }*/ return(true); } return(false); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); bool castOnTarget = true; if (source.Target().hasTarget) { if (FriendTargetInvalid(source)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); //return false; castOnTarget = false; } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); //return false; } castOnTarget = false; } } else { castOnTarget = false; } float healMult = skill.GetFloatInput("heal_mult"); var weapon = source.Weapon(); float damage = weapon.GetDamage().totalDamage; float healValue = damage * healMult; bool mastery = RollMastery(source); if (mastery) { healValue *= 2; info.SetMastery(true); } else { info.SetMastery(false); } if (castOnTarget) { //firtst heal friend var heal = source.Weapon().Heal(source.Target().targetObject, healValue, skill.data.Id); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); } //second heal self var selfHeal = source.Weapon().HealSelf(healValue, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, selfHeal); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); bool castOnTarget = true; if (source.Target().hasTarget) { if (FriendTargetInvalid(source)) { info.SetSkillUseState(Common.SkillUseState.invalidTarget); //return false; castOnTarget = false; } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); //return false; castOnTarget = false; } } } else { castOnTarget = false; } float healMult = skill.GetFloatInput("heal_mult"); float resistPc = skill.GetFloatInput("resist_pc"); float resistTime = skill.GetFloatInput("resist_time"); float damage = source.Weapon().GetDamage().totalDamage; float healing = damage * healMult; bool mastery = RollMastery(source); if (mastery) { healing *= 2; resistTime *= 2; info.SetMastery(true); } else { info.SetMastery(false); } NebulaObject targetObject = null; if (castOnTarget) { targetObject = source.Target().targetObject; var heal = source.Weapon().Heal(targetObject, healing, skill.data.Id); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); Buff resistBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, resistTime, resistPc); targetObject.Bonuses().SetBuff(resistBuff, source); } targetObject = source; var heal2 = source.Weapon().Heal(targetObject, healing, skill.data.Id); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal2); Buff resistBuff2 = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, resistTime, resistPc); targetObject.Bonuses().SetBuff(resistBuff2, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); bool castOnTarget = true; if (source.Target().hasTarget) { if (FriendTargetInvalid(source)) { castOnTarget = false; } else { if (NotCheckDistance(source)) { info.SetSkillUseState(Common.SkillUseState.tooFar); return(false); } } } else { castOnTarget = false; } float dmgMult = skill.GetFloatInput("dmg_mult"); var weapon = source.Weapon(); float damage = weapon.GetDamage().totalDamage; float absorbedDamage = dmgMult * damage; //NebulaObject target = null; //if(CheckForHealAlly(source)) { // target = source.Target().targetObject; //} else { // target = source; //} bool mastery = RollMastery(source); if (mastery) { absorbedDamage *= 2; info.SetMastery(true); } else { info.SetMastery(false); } if (castOnTarget) { source.Target().targetObject.Bonuses().SetAbsrobBuff(absorbedDamage, source); } else { source.Bonuses().SetAbsrobBuff(absorbedDamage, source); } //target.Damagable().SetAbsorbDamage(absorbedDamage); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(SkillUseState.normal); float odMult = skill.GetFloatInput("od_mult"); bool mastery = RollMastery(source); if (mastery) { odMult *= 2; info.SetMastery(true); } else { info.SetMastery(false); } var sourceTarget = source.Target(); if (sourceTarget.targetObject) { var targetObject = sourceTarget.targetObject; var targetCharacter = targetObject.Character(); if (targetCharacter) { var relation = source.Character().RelationTo(targetCharacter); if (relation == Common.FractionRelation.Friend) { var sourceWeapon = source.Weapon(); if (source.transform.DistanceTo(targetObject.transform) <= odMult * sourceWeapon.optimalDistance) { source.MmoMessage().StartJumpToPosition(targetObject.transform.position, skill.data.Id); return(true); } else { info.SetSkillUseState(SkillUseState.tooFar); } } else { info.SetSkillUseState(SkillUseState.invalidTarget); } } else { info.SetSkillUseState(SkillUseState.invalidTarget); } } else { info.SetSkillUseState(SkillUseState.invalidTarget); } return(false); }