public string Effect(string user, PotionEffects effectId, int duration = 30, int amplifier = 0) { string cmd = string.Empty; if (string.IsNullOrWhiteSpace(user)) { throw new ArgumentNullException("user", "You must provide the user you're effecting."); } if (duration <= 0 || duration > 1000000) { throw new ArgumentOutOfRangeException("duration", "You must provide a duration value between 1 and 1,000,000."); } if (amplifier < 0) { throw new ArgumentOutOfRangeException("amplifier", "You must provide an amplifier value greater than 0."); } else if (amplifier == 0) { cmd = string.Format(TonkaCommands.CMD_EFFECT_SECONDS, user, EnumUtils.GetEnumDefaultValue(effectId), duration); } else { cmd = string.Format(TonkaCommands.CMD_EFFECT_SECONDS_AMPD, user, EnumUtils.GetEnumDefaultValue(effectId), duration, amplifier); } string result = SendCommand(cmd); return(result); }
public PotionEffects GetEffects() { PotionEffects newEffect = PossibleEffects[Random.Range(0, PossibleEffects.Count)]; PossibleEffects.Remove(newEffect); return(newEffect); }
public void OnPointerClick(PointerEventData eventData) { if (potionInstance.isIdentified == false) { PotionEffects newEffect = potionsAvailable.GetEffects(); potionInstance.AddEffect("Identificada", newEffect.potionNameTxt, newEffect.potionEffectName, newEffect.potionEffectDescription); potionButton.AttributePotionEffect(); } PopUp.SetActive(false); potionButton.ReduceQuantity(); sfxAudioSource.PlayOneShot(useSfx); }
public string Effect(string user, PotionEffects effectId, int duration = 30, int amplifier = 0) { string cmd = string.Empty; if (string.IsNullOrWhiteSpace(user)) { throw new ArgumentNullException("user", "You must provide the user you're effecting."); } if (duration <= 0 || duration > 1000000) { throw new ArgumentOutOfRangeException("duration", "You must provide a duration value between 1 and 1,000,000."); } if (amplifier < 0) { throw new ArgumentOutOfRangeException("amplifier", "You must provide an amplifier value greater than 0."); } else if (amplifier == 0) { cmd = string.Format(TonkaCommands.CMD_EFFECT_SECONDS, user, EnumUtils.GetEnumDefaultValue(effectId), duration); } else { cmd = string.Format(TonkaCommands.CMD_EFFECT_SECONDS_AMPD, user, EnumUtils.GetEnumDefaultValue(effectId), duration, amplifier); } string result = SendCommand(cmd); return result; }