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(); float damageMult = skill.GetFloatInput("dmg_mult"); float hpPc = skill.GetFloatInput("hp_pc"); float hpRestoredPc = skill.GetFloatInput("hp_restored_pc"); bool targetHpLow = true; if (targetDamagable.health > targetDamagable.maximumHealth * hpPc) { targetHpLow = false; } if (!targetHpLow) { damageMult = 1; } bool mastery = RollMastery(source); if (mastery) { damageMult *= 2; } WeaponHitInfo hit; var shot = sourceWeapon.Fire(out hit, skill.data.Id, damageMult); if (hit.normalOrMissed) { if (targetDamagable.killed) { float resotedHp = source.Damagable().maximumHealth *hpRestoredPc; if (mastery) { resotedHp *= 2; } source.Damagable().RestoreHealth(source, resotedHp); } 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 damagable = source.Damagable(); float hpPc = skill.GetFloatInput("hp_pc"); float hpPcTimed = skill.GetFloatInput("hp_pc_timed"); float hpTime = skill.GetFloatInput("hp_time"); bool mastery = RollMastery(source); if (mastery) { hpPc *= 2; hpTime *= 2; } float restoreInstance = damagable.maximumHealth * hpPc; damagable.RestoreHealth(source, restoreInstance); float hpPerSec = damagable.maximumHealth * hpPcTimed / hpTime; string id = source.Id + skill.data.Id.ToString(); damagable.SetRestoreHPPerSec(hpPerSec, hpTime, id); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); if (NotEnemyCheck(source, skill, info)) { return(false); } float dmgMult = skill.GetFloatInput("dmg_mult"); float hpMult = skill.GetFloatInput("hp_mult"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; hpMult *= 2; } WeaponHitInfo hit; var shot = source.Weapon().Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { float hp = hit.actualDamage.totalDamage * hpMult; source.Damagable().RestoreHealth(source, hp); 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(); float hpRestorePc = skill.GetFloatInput("hp_restore_pc"); float maxHpPc = skill.GetFloatInput("max_hp_pc"); bool mastery = RollMastery(source); if (mastery) { maxHpPc *= 2; hpRestorePc *= 2; } var damagable = source.Damagable(); float restoredHp = hpRestorePc * damagable.baseMaximumHealth; damagable.RestoreHealth(source, restoredHp); var skills = source.Skills(); Buff buff = new Buff(skill.data.Id.ToString(), source, Common.BonusType.increase_max_hp_on_pc, -1, maxHpPc, () => { return(true); }, skill.data.Id); source.Bonuses().SetBuff(buff, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); var damagable = source.Damagable(); float hpPc = skill.GetFloatInput("hp_pc"); float hpTime = skill.GetFloatInput("hp_time"); float hpBuffPc = skill.GetFloatInput("hpbuff_pc"); float hpBuffTime = skill.GetFloatInput("hpbuff_time"); float hpForSec = damagable.maximumHealth * hpPc / hpTime; string id = source.Id + skill.data.Id.ToString(); bool mastery = RollMastery(source); if (mastery) { hpForSec *= 2; hpBuffTime *= 2; } damagable.SetRestoreHPPerSec(hpForSec, hpTime, id); Buff buff = new Buff(skill.id, null, Common.BonusType.increase_healing_speed_on_pc, hpBuffTime, hpBuffPc); source.Bonuses().SetBuff(buff, source); return(true); }
protected virtual bool CheckWeaponTarget(NebulaObject target) { if (ready && nebulaObject && target.Damagable()) { return(true); } 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 hpPc = skill.GetFloatInput("hp_pc"); float radius = skill.GetFloatInput("radius"); bool mastery = RollMastery(source); if (mastery) { dmgMult *= 2; hpPc *= 2; info.SetMastery(true); } else { info.SetMastery(false); } float hpVal = source.Damagable().maximumHealth *hpPc; WeaponHitInfo hit; var shot = source.Weapon().Fire(out hit, skill.data.Id, dmgMult); if (hit.normalOrMissed) { //Buff speedBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, speedTime, speedPc); //source.Bonuses().SetBuff(speedBuff, source); source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot); var sWeapon = source.Weapon(); var mmoMsg = source.MmoMessage(); foreach (var friend in GetNearestFriends(source, radius)) { var heal = sWeapon.Heal(friend.Value, hpVal, skill.idInt); mmoMsg.SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); } return(true); } return(false); }
private float MaxHealth(NebulaObject obj) { var dmg = obj.Damagable(); if (dmg != null) { return(dmg.maximumHealth); } return(0); }
protected void CompleteForceShot(NebulaObject obj, ref WeaponHitInfo hit, float damageMult, bool useDamageMultSelfAsDamage, InputDamage inputDamage) { CheckWeaponBlocked(hit); if (hit.normal) { CheckWeaponDistance(obj, hit); if (hit.normal) { UnblockSingleShot(); ApplyDamage(ref hit, obj.Damagable(), damageMult, useDamageMultSelfAsDamage, inputDamage); } } }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); float hpPc = skill.data.Inputs.GetValue <float>("hp_pc", 0f); float hpAlliesPc = skill.data.Inputs.GetValue <float>("hp_allies_pc", 0f); float hpRestoreTime = skill.data.Inputs.GetValue <float>("hp_pc_time", 0f); var selfDamagable = source.Damagable(); var selfCharacter = source.Character(); var selfWeapon = source.Weapon(); float selfRestoreHP = selfDamagable.maximumHealth * hpPc; float alliesRestoreHP = selfDamagable.maximumHealth * hpAlliesPc; bool mastery = RollMastery(source); if (mastery) { selfRestoreHP *= 2; alliesRestoreHP *= 2; } selfDamagable.SetRestoreHPPerSec(selfRestoreHP / hpRestoreTime, hpRestoreTime, source.Id + skill.data.Id.ToString()); var allies = source.mmoWorld().GetItems(ItemType.Avatar, (item) => { if (item.Id != source.Id) { var character = item.Character(); var damagable = item.Damagable(); if (character && damagable) { if (selfCharacter.RelationTo(character) == FractionRelation.Friend) { if (item.transform.DistanceTo(source.transform) < selfWeapon.optimalDistance) { return(true); } } } } return(false); }); foreach (var friend in allies) { friend.Value.Damagable().RestoreHealth(source, alliesRestoreHP); } 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(); float time = skill.GetFloatInput("time"); bool mastery = RollMastery(source); if (mastery) { time *= 2; } source.Damagable().SetIgnoreDamage(time); Buff blockWeaponDebuff = new Buff(skill.id, null, Common.BonusType.block_weapon, time); source.Bonuses().SetBuff(blockWeaponDebuff, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { bool result = base.TryCast(source, skill, out info); if (result) { var damagable = source.Damagable(); float hpPc = skill.GetFloatInput("hp_pc"); bool mastery = RollMastery(source); if (mastery) { hpPc *= 2; } //damagable.RestoreHealth(source, damagable.maximumHealth * hpPc); var heal = source.Weapon().HealSelf(damagable.maximumHealth * hpPc, skill.idInt); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal); } return(result); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); float hpPc = skill.GetFloatInput("hp_pc"); float hpTime = skill.GetFloatInput("hp_time"); float radius = skill.GetFloatInput("radius"); var damagable = source.Damagable(); float restoredHp = hpPc * damagable.maximumHealth; float restoredHpPerSec = restoredHp / hpTime; string id = source.Id + skill.data.Id.ToString(); bool mastery = RollMastery(source); if (mastery) { hpTime *= 2; restoredHpPerSec *= 2; info.SetMastery(true); } else { info.SetMastery(false); } //damagable.SetRestoreHPPerSec(restoredHpPerSec, hpTime, id); foreach (var item in GetNearestFriends(source, radius)) { item.Value.Damagable().SetRestoreHPPerSec(restoredHpPerSec, hpTime, id); } return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); var ship = source.PlayerShip(); if (!ship) { return(false); } float hpPc = skill.GetFloatInput("hp_pc"); float maxResist = skill.GetFloatInput("max_resist"); float speedPc = skill.GetFloatInput("speed_pc"); float time = skill.GetFloatInput("time"); var damagable = source.Damagable(); var bonuses = source.Bonuses(); bool mastery = RollMastery(source); if (mastery) { time *= 2; } if (damagable.health < damagable.maximumHealth * hpPc) { float currentResistance = ship.commonResist; float resistanceDifference = Mathf.ClampLess(maxResist - currentResistance, 0f); Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, time, resistanceDifference); bonuses.SetBuff(buff, source); } Buff speedBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, time, speedPc); bonuses.SetBuff(speedBuff, source); return(true); }
public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info) { info = new Hashtable(); info.SetSkillUseState(Common.SkillUseState.normal); float hpPc = skill.GetFloatInput("hp_pc"); float hpPcTimed = skill.GetFloatInput("hp_pc_timed"); float hpTime = skill.GetFloatInput("hp_time"); var damagable = source.Damagable(); float maxHealth = damagable.maximumHealth; float hpInstance = hpPc * maxHealth; float hpRestorePerSec = hpPcTimed * maxHealth / hpTime; string id = source.Id + skill.data.Id.ToString(); bool mastery = RollMastery(source); if (mastery) { hpInstance *= 2; hpTime *= 2; hpRestorePerSec *= 2; info.SetMastery(true); } else { info.SetMastery(false); } //damagable.RestoreHealth(source, hpInstance); source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, source.Weapon().HealSelf(hpInstance, skill.idInt)); damagable.SetRestoreHPPerSec(hpRestorePerSec, hpTime, id); return(true); }
public virtual Hashtable Heal(NebulaObject targetObject, float healValue, int skillID = -1, bool generateCrit = true) { MakeMeVisible(); WeaponDamage notCritDmg = GetDamage(false); WeaponDamage critDmg = GetDamage(true); float ratio = critDmg.totalDamage / notCritDmg.totalDamage; healValue = Mathf.ClampLess(healValue * (1.0f + cachedBonuses.healingPcBonus) + cachedBonuses.healingCntBonus, 0f); bool isCritHeal = false; if (generateCrit) { if (Rand.Float01() < criticalChance) { isCritHeal = true; healValue *= ratio; } } var targetDamaable = targetObject.Damagable(); targetDamaable.RestoreHealth(nebulaObject, healValue); nebulaObject.SendMessage(ComponentMessages.OnMakeHeal, healValue); StartHealDron(targetDamaable, healValue); if (isCritHeal) { nebulaObject.SendMessage(ComponentMessages.OnCriticalHeal, healValue); } return(ConstructHealMessage(nebulaObject, targetObject, cachedCharacter.workshop, skillID, healValue, isCritHeal)); }
public virtual Hashtable Fire(NebulaObject targetObject, out WeaponHitInfo hit, int skillID = -1, float damageMult = 1.0f, bool forceShot = false, bool useDamageMultSelfAsDamage = false) { m_NotResettableShotCounter++; MakeMeVisible(); hit = new WeaponHitInfo(); if (CheckWeaponTarget(targetObject)) { Hashtable result = new Hashtable(); result.Add((int)SPC.Source, nebulaObject.Id); result.Add((int)SPC.SourceType, nebulaObject.Type); result.Add((int)SPC.Target, targetObject.Id); result.Add((int)SPC.TargetType, targetObject.Type); result.Add((int)SPC.Workshop, cachedCharacter.workshop); result.Add((int)SPC.Skill, skillID); //InputDamage inputDamage = new InputDamage(nebulaObject, GetDamage()) if (forceShot) { InputDamage inputDamage = new InputDamage(nebulaObject, GetDamage(false)); CompleteForceShot(targetObject, ref hit, damageMult, useDamageMultSelfAsDamage, inputDamage); inputDamage.SetHitInfo(hit); } else { CheckWeaponBlocked(hit); if (hit.interrupted) { UnblockSingleShot(); WeaponDamage dmg = GetDamage(false); dmg.ClearAllDamages(); InputDamage inputDamage = new InputDamage(nebulaObject, dmg); inputDamage.SetHitInfo(hit); } else { WeaponDamage damage = null; if (IsCritical(ref hit)) { damage = GetDamage(true); } else { damage = GetDamage(false); } InputDamage inputDamage = new InputDamage(nebulaObject, damage); CheckWeaponDistance(targetObject, hit); if (hit.interrupted) { damage.ClearAllDamages(); } else { CheckWeaponHit(targetObject, hit); if (hit.interrupted) { damage.ClearAllDamages(); } else { if (nebulaObject.IsPlayer()) { nebulaObject.SendMessage(ComponentMessages.OnCriticalHit); } shotCounter++; ApplyDamage(ref hit, targetObject.Damagable(), damageMult, useDamageMultSelfAsDamage, inputDamage); } } inputDamage.SetHitInfo(hit); } } foreach (DictionaryEntry entry in hit.GetInfo()) { result[(int)entry.Key] = entry.Value; } CheckPlayerAgro(targetObject); SendFireMessage(hit); //log.InfoFormat("final hit state: {0}", hit.state); return(result); } return(new Hashtable()); }