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