//Indikatioren für Varibeltypen //§=TriggerValue,constantValue //$=StringValue //%=NumericValue //Aufbau des Sykripts //Trigger //Variabel //Skript public EffectScriptObject(string _Script, IRPGSource _Source, RPGObject _Target, TEffect _Effect) { Source = _Source; Afflicted = _Target; string[] Lines = _Script.Split (';'); int state = 0; for (int i=0; i<Lines.Length; i++) { Lines [i] = Lines [i].ToLower (); if (Lines [i] == "endblock") { state++; continue; } if (state == 0) { //Trigger } else if (state == 1) { //Variablen string varstring = Lines [i]; if (varstring [0] == '$') { sValues.Add (new StringValue (varstring.Split ('=') [0].TrimStart ('$'), varstring.Split ('=') [1])); } if (varstring [0] == '%') { nValues.Add (new NumericValue (varstring.Split ('=') [0].TrimStart ('%'), System.Convert.ToInt16 (varstring.Split ('=') [1]))); } } else if (state == 2) { //Script Script.Add (Lines [i]); } } }
protected override float recieveHealing(float Value,IRPGSource Source) { Value *= GetCurrentValueModification ("healingamplification"); //Send Triggers foreach(TEffect e in Effects) foreach(EffectScriptObject so in e.ScriptObjects) so.OnRecieveHealing(ref Value,Source); _cHP += Value; return Value; }
protected override float _recieveDamage(float Value, string Typ, IRPGSource Source) { //Apply Resistance Value -= this["Resistance_" + Typ]; Value *= this ["Resistance%_" + Typ]; if (Value > 0) { foreach(TEffect e in Effects) foreach(EffectScriptObject so in e.ScriptObjects) so.OnTakeDamage(ref Value,Typ,Source);//Send DamageMessage _cHP-=Value; //Add Destruction } else if (Value < 0) return recieveHealing (Value,Source); return Value; }
//Dient zum Verrechnen von Heilung mit beispielsweise Heilmodifikationen protected abstract float recieveHealing(float Value, IRPGSource Source);
public virtual void sendMessage(string Message, IRPGSource Source) { }
//Funktionsrümpfe //Diese Funktion dient zum Zugriff auf den HP-Wert oder so, gibt die Menge des angerichten schaden zurück. Heilungen. bzw Absorbtionen müssen an die RecieveHealing Funktion weitergegeben werden. public float recieveDamage(float _value,string _typ,IRPGSource _source) { MyNetworkManager.DistributeIDComponentUpdate (this, new IDComponentUpdateMsg (3, FileHelper.serializeObject<string> (_value.ToString()+";"+_typ+";"+_source.getID()))); return _recieveDamage (_value, _typ, _source); }
public bool addEffect(TEffect effect,IRPGSource source) { MyNetworkManager.DistributeIDComponentUpdate (this, new IDComponentUpdateMsg (1, FileHelper.serializeObject<AddEffectMsg> (new AddEffectMsg (effect, source.getID ())))); return _addEffect (effect, source); }
//Dient zum Verrechnen von Heilung mit beispielsweise Heilmodifikationen protected override float recieveHealing (float Value,IRPGSource Source) { //Send Triggers foreach(TEffect e in Effects) foreach(EffectScriptObject so in e.ScriptObjects) so.OnRecieveHealing(ref Value,Source); Value *= GetCurrentValueModification ("healingamplification"); _cHitpoints = Mathf.Clamp (_cHitpoints + Value, 0, _cVitality); return Value; }
/* //Diese Funktion gibt wieder ob das Objekt versteckt ist(return bool) und zusätzliche Informatioen wie diese Tarnung aufgebaut ist. public override bool IsVisible (out int HideValue, out AttributModificationHelper.Modification[] UseEffects) { if (CMS == CreatureMovementStatus.Sneaking || GetCurrentValueModification ("invisibility") > 0) { HideValue = (int)this ["hide"] + (int)GetCurrentValueModification ("invisibility"); List<AttributModificationHelper.Modification> result = AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == "hide"; }).UsedModifications; result.AddRange (AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == "invisibility"; }).UsedModifications); UseEffects = result.ToArray (); return true; } HideValue = 0; UseEffects = null; return false; }*/ //Diese Funktion dient zum Zugriff auf den HP-Wert oder so, gibt die Menge des angerichten schaden zurück. Heilungen. bzw Absorbtionen müssen an die RecieveHealing Funktion weitergegeben werden. protected override float _recieveDamage (float Value, string Typ, IRPGSource Source) { if (Typ != "abilitycost") { //Apply Resistance Value-=this["Resistance_"+Typ]; Value*=this["Resistance%_"+Typ]; } if (Value > 0) { //Send Damage Messgae to Effects foreach(TEffect e in Effects) foreach(EffectScriptObject so in e.ScriptObjects) so.OnTakeDamage(ref Value,Typ,Source); _cHitpoints -= Value; if (_cHitpoints < 0) { Value = _cHitpoints / -10; _cVitality -= Value; _cHitpoints = 0; } return Value; } else if (Value < 0) return recieveHealing (Value,Source); return 0; }
public void OnRecieveHealing(ref float value,IRPGSource source) { if (!Effect.IsSupressed && RecieveHealing) { NumericValue v=new NumericValue("value",value); nValues.Add(v); Paramter s=new Paramter("source",source); ExecuteScript(new Paramter[]{s}); nValues.Remove(v); value=v.Value; } }
public RPGEvent(string message, IRPGSource sourceObject) { _message = message; _source = sourceObject.getID(); _timeCode = System.DateTime.Now; }
public Paramter(string _Name, IRPGSource _Object) { Name = _Name; O = _Object; _O=null; }
public void OnTakeDamage(ref float value, string Type,IRPGSource source) { if (!Effect.IsSupressed && TakeDamage) { NumericValue v=new NumericValue("value",value); nValues.Add(v); StringValue t=new StringValue("type",Type); sValues.Add(t); Paramter s=new Paramter("source",source); ExecuteScript(new Paramter[]{s}); nValues.Remove(v); sValues.Remove(t); value=v.Value; } }
protected virtual bool _addEffect(TEffect Effect,IRPGSource source) { //Überprüfe zunächst ob ein Schutz gegen den Effekt exestiert if (!cEffects.Exists (delegate(TEffect obj) { foreach (string effs in obj.WorkingPassiveEffectStrings) { string[] splitted = effs.Split (' '); if (splitted [0] == "protectagainst" && (splitted [1] == Effect.GeneralCategory || Effect.Tags.Contains (splitted [1])) && System.Convert.ToInt16 (splitted [2]) > Effect.GeneralOrder) return true; } return false; })) { OnNewEffect (Effect);//Füge den neuen Effekt in das Helper System ein cEffects.Add (Effect);//Füge ihn in die Liste der Effekte ein Effect.HookUp(source,this,IDCounter++); // UpdateStatistics ();//Aktualisiere die Statisitk(wird erst nach anknüpfen aller Effekte von der Gegenseite aufgerufen!) return true;//Effekt erfolgreich hinzugefügt! } return false;//Effekt konnte nicht hinzugefügt werden! }
public void HookUp(IRPGSource source,RPGObject afflicted,ulong id) { this.afflicted = afflicted; _ownID = id; cDuration = oDuration; OriginalSource = source; scriptObjects = new EffectScriptObject[ActiveEffectStrings.Length]; for (int i=0; i<scriptObjects.Length; i++) scriptObjects [i] = new EffectScriptObject (ActiveEffectStrings [i], source, afflicted, this); }
protected abstract float _recieveDamage(float Value, string Typ, IRPGSource Source);
public void OnActivate(IRPGSource s) { if (!Effect.IsSupressed && AllowActivate) ExecuteScript (null); }