public void OnEnemyDeath(PlayerSkills mySkills) { int skillID = SkillExecutor.SkilIDFromHexString("00000439"); var skill = mySkills.GetSkillById(skillID); if (skill == null || skill.IsEmpty) { return; } float critDmgPc = skill.GetFloatInput("crit_dmg_pc"); float critDmgTime = skill.GetFloatInput("crit_dmg_time"); int stackCount = skill.GetIntInput("stack_count"); bool mastery = RollMastery(mySkills.nebulaObject); if (mastery) { critDmgTime *= 2; } int buffsCount = mySkills.bonuses.GetBuffCountWithTag(Common.BonusType.increase_crit_damage_on_pc, skillID); if (buffsCount < stackCount) { Buff newBuff = new Buff(Guid.NewGuid().ToString(), null, Common.BonusType.increase_crit_damage_on_pc, critDmgTime, critDmgPc); newBuff.SetTag(skillID); mySkills.bonuses.SetBuff(newBuff, mySkills.nebulaObject); } s_Log.InfoFormat("439.OnEnemyDeath()->critdmg% = {0}, critdmgtime={1}, stackcnt={2}, buffscnt={3}, bonustotal={4}".Color(LogColor.orange), critDmgPc, critDmgTime, stackCount, buffsCount, mySkills.bonuses.critDamagePcBonus); }
private bool UpdateSkillUsing(float distance) { if (skillCD > 0) { return(false); } if (distance > mWeapon.optimalDistance) { return(false); } if (m_Skills && m_CurrentSkills != null) { if (m_CurrentSkills.Count > 0) { //int slot = m_SlotsWithSkills.AnyElement(); int skill = m_CurrentSkills.AnyElement(); int slot = m_Skills.GetSlotBySkillId(skill); if (slot >= 0) { var skillObj = m_Skills.GetSkillById(skill); if (skillObj != null) { if (skillObj.ready && skillObj.energyOk) { if (m_Skills.UseSkill(slot, mTarget.targetObject)) { skillCD = skillObj.data.Cooldown; //log.InfoFormat("NPC used skill = {0}".Color(LogColor.orange), skillObj.data.Id.ToString("X8")); //log.InfoFormat("npc successfully used skill at slot = {0}, energy = {1}".Color(LogColor.orange), slot, GetComponent<ShipEnergyBlock>().currentEnergy); return(true); } } } } } } return(false); }
public virtual void Update(float deltaTime) { if (!valid) { return; } if (m_RequireSkill) { //for timed buff update timer if (interval > 0) { mTimer -= deltaTime; if (mTimer <= 0f) { valid = false; if (mExpireAction != null) { mExpireAction(); } return; } } else { //for non timed persistent buff check owner and state of owner skill if (!owner) { valid = false; return; } //check that skill present at owner var skill = cachedSkills.GetSkillById(sourceSkillId); if (skill == null) { valid = false; return; } //chect skill type if (skill.data.Type != SkillType.Persistent) { valid = false; return; } //check skill is enabled if (skill.isOn == false) { valid = false; return; } } if (customCheck != null) { if (!customCheck()) { valid = false; return; } } } else { if (customCheck != null) { if (!customCheck()) { valid = false; return; } } else { throw new Exception("Not required skill buff must have custom check function!!!"); } } if (mUpdateAction != null) { mUpdateAction(); } }