blob: 8dd622fdf7be1da59d1113e9c92e0792e6411211 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001ModifySkill()
2FUNKTION:
3 public varargs void ModifySkill(string sname, mixed val,
4 int diff, string gilde)
5
6DEFINIERT IN:
7 /std/living/skills.c
8
9ARGUMENTE:
10 string sname der zu aendernde Skill
11 mixed val Aenderungswert: int fuer SI_SKILLABILITY, sonst mapping
12 int diff Schwierigkeit (optional: default ist existierendes diff)
13 string gilde Gilde (optional: default ist eigene Gilde)
14
15BESCHREIBUNG:
16 Mit der Methode kann man die Werte eines Skills/Spells veraendern. Dabei
17 wird ein Skill immer in ein Mapping umgewandelt (Skills/Spells koennen
18 auch einfach nur ihren Skillwert enthalten, diese ist aequivalent zu
19 einem Mapping mit ([SI_SKILLABILITY:<Skillwert>]).
20
21 Ist 'val' ein int, wird dieses als SI_SKILLABILITY gesetzt. Falls der
22 Skill nur ein int war, wird ein 'diff'!=0 als SI_DIFFICULTY gesetzt.
23
24 Ist 'val' ein Mapping, wird dieses zum Skillmapping addiert.
25
26 Etwaige SI_SKILLABILITY-Aenderungen laufen danach noch durch LimitAbility.
27
28BEISPIELE:
29 // #1a: Lerne einen Spell/Skill (einer Gilde)
30 caster->ModifySkill("feuerball", MAX_ABILITY, 100, "abenteurer")
31 // #1b: ... oder ...
32 caster->ModifySkill("feuerball", ([SI_SKILLABILITY: MAX_ABILITY]), 100,
33 "abenteurer")
34 // #1c: ... oder fuer einen Abenteurer ...
35 caster->ModifySkill("feuerball", ([SI_SKILLABILITY: MAX_ABILITY]), 100);
36
37 // #2: Setze eine Skill-Funktion fuer einen Kampfskill des Klerus
38 this_player()->ModifySkill(FIGHT(WT_CLUB),
39 ([SI_SKILLFUNC: "Keulenkampf",
40 SI_DIFFICULTY: 100]),
41 100, "klerus");
42
43 // #3: Speichere im Skill (also Spieler) eine Option fuer diesen Skill
44 // Vorteil: dieser Eintrag wird dem Spell immer uebergeben
45 caster->ModifySkill("blitz", (["klerus_spell_option": 2]));
46
47 (Code in /doc/beispiele/testobjekte/modifyskillspell_test)
48 // #4: Lerne einen unabhaengigen Spell: ACHTUNG
49 // dieser Spell funktioniert nur solange, wie die Closure existiert,
50 // SI_SKILLABILITY und Spell bleiben jedoch im Spieler gespeichert (!)
51 this_player()->ModifySkill("fnrx",
52 ([SI_CLOSURE:
53 function int (object caster, string skill, mapping sinf) {
54 caster->LearnSkill("fnrx", 1);
55 tell_object(caster, "Peng! Dein Skillwert steigt auf "+
56 caster->QuerySkillAbility("fnrx")+".\n");
57 return ERFOLG;
58 },
59 SI_SKILLABILITY: 8432]),
60 100,
61 "ANY");
62
63SIEHE AUCH:
64 Skills Lernen: LearnSkill, LimitAbility
65 * Nutzung: UseSpell, UseSkill
66 * Abfragen: QuerySkill, QuerySkillAbility
67 * Modifikation: ModifySkillAttribute, QuerySkillAttribute,
68 QuerySkillAttributeModifier, RemoveSkillAttributeModifier
69 * Properties: P_SKILL_ATTRIBUTES, P_SKILL_ATTRIBUTE_OFFSETS
70 * sonstig: spruchermuedung
71 * Properties: P_NEWSKILLS
72
733. Okt 2011 Gloinson