public static void CheckBuffAdd(BattleObject source) { int skillID = source.damage.skillID; bool isWeaponDamage = source.damage.isWeaponDamage; SkillData skillData = DataManager.Instance.GetSkillDataSet().GetSkillData(skillID); for(int i = 0; i < skillData.buffID.Count; i++) { if(skillData.buffID[i] == 0)continue; int random = UnityEngine.Random.Range(0, 101); if(random <= skillData.buffPercent[i]) { if(skillData.buffAddTriggers[i] == (int)BuffAddTrigger.SelfAfterDamage) { source.AddBuff(skillData.buffID[i], skillData.buffTurns[i]); } else if(skillData.buffAddTriggers[i] == (int)BuffAddTrigger.TargetAfterDamage) { source.damage.target.AddBuff(skillData.buffID[i], skillData.buffTurns[i]); } } } if(isWeaponDamage) { WeaponData weaponData = DataManager.Instance.GetItemDataSet().GetWeaponData(source.GetWeapon()); for(int i = 0; i < weaponData.buffID.Count; i++) { if(weaponData.buffID[i] == 0)continue; int random = UnityEngine.Random.Range(0, 101); if(random <= weaponData.buffPercent[i]) { if(weaponData.buffAddTriggers[i] == (int)BuffAddTrigger.SelfAfterDamage) { source.AddBuff(weaponData.buffID[i], weaponData.buffTurns[i]); } else if(weaponData.buffAddTriggers[i] == (int)BuffAddTrigger.TargetAfterDamage) { source.damage.target.AddBuff(weaponData.buffID[i], weaponData.buffTurns[i]); } } } } }
public static void CheckWeaponBuff(BattleObject source, int offID = 0) { if(offID > 0) { WeaponData oldWeaponData = DataManager.Instance.GetItemDataSet().GetWeaponData(offID); for(int i = 0; i < oldWeaponData.buffID.Count; i++) { if(oldWeaponData.buffID[i] == 0)continue; if(oldWeaponData.buffAddTriggers[i] == (int)BuffAddTrigger.Self) { source.RemoveBuff(oldWeaponData.buffID[i]); } } } WeaponData weaponData = DataManager.Instance.GetItemDataSet().GetWeaponData(source.GetWeapon()); for(int i = 0; i < weaponData.buffID.Count; i++) { if(weaponData.buffID[i] == 0)continue; int random = UnityEngine.Random.Range(0, 101); if(random <= weaponData.buffPercent[i]) { if(weaponData.buffAddTriggers[i] == (int)BuffAddTrigger.Self) { source.AddBuff(weaponData.buffID[i], weaponData.buffTurns[i]); } } } }