Skip to content
Permalink
Browse files

Merged PR 570: Merge 634_generate_environment to master

Related work items: #637
  • Loading branch information...
realms-mud committed Sep 5, 2019
1 parent b2a5cb9 commit b771ea65a7363e1ae84e341cc7d22988207d0bcd
Showing with 374 additions and 67 deletions.
  1. +91 −0 dictionaries/personaDictionary.c
  2. +49 −29 dictionaries/personas/creatures.h
  3. +19 −0 dictionaries/personas/fighters.h
  4. +10 −0 dictionaries/personas/magicUsers.h
  5. +6 −0 dictionaries/racialDictionary.c
  6. +53 −3 dictionaries/regionDictionary.c
  7. +19 −15 dictionaries/regions/region-types.h
  8. +17 −10 environment/environment.c
  9. +55 −3 environment/generatedEnvironment.c
  10. 0 instances/traits/personas/{creatures → animal}/bat.c
  11. 0 instances/traits/personas/{creatures → animal}/bear.c
  12. 0 instances/traits/personas/{creatures → animal}/boar.c
  13. 0 instances/traits/personas/{creatures → animal}/cat.c
  14. 0 instances/traits/personas/{creatures → animal}/dog.c
  15. 0 instances/traits/personas/{creatures → animal}/eagle.c
  16. 0 instances/traits/personas/{creatures → animal}/horse.c
  17. 0 instances/traits/personas/{creatures → animal}/mountain-lion.c
  18. 0 instances/traits/personas/{creatures → animal}/panther.c
  19. 0 instances/traits/personas/{creatures → animal}/rat.c
  20. 0 instances/traits/personas/{creatures → animal}/raven.c
  21. 0 instances/traits/personas/{creatures → animal}/weasel.c
  22. 0 instances/traits/personas/{creatures → animal}/wolf.c
  23. 0 instances/traits/personas/{creatures → animal}/wolverine.c
  24. 0 instances/traits/personas/{creatures → undead}/ghast.c
  25. 0 instances/traits/personas/{creatures → undead}/ghoul.c
  26. 0 instances/traits/personas/{creatures → undead}/lich.c
  27. 0 instances/traits/personas/{creatures → undead}/mohrg.c
  28. 0 instances/traits/personas/{creatures → undead}/mummy.c
  29. 0 instances/traits/personas/{creatures → undead}/nukulevee.c
  30. 0 instances/traits/personas/{creatures → undead}/shadow.c
  31. 0 instances/traits/personas/{creatures → undead}/skeleton.c
  32. 0 instances/traits/personas/{creatures → undead}/spectre.c
  33. 0 instances/traits/personas/{creatures → undead}/vampire.c
  34. 0 instances/traits/personas/{creatures → undead}/wight.c
  35. 0 instances/traits/personas/{creatures → undead}/wraith.c
  36. 0 instances/traits/personas/{creatures → undead}/zombie.c
  37. +4 −1 modules/materialAttributes.c
  38. +11 −3 modules/personas.c
  39. +1 −1 modules/races.c
  40. +2 −1 tests/commands/wizard/statTest.c
  41. +24 −0 tests/environment/generatedEnvironmentTest.c
  42. +1 −0 tests/modules/combatChatterTest.c
  43. +12 −1 tests/modules/personaTest.c
@@ -177,6 +177,19 @@ private int minimumLevelMet(object character, string persona)
character->effectiveLevel())));
}

/////////////////////////////////////////////////////////////////////////////
private nomask void SetRace(object character, string persona)
{
object racialDictionary =
load_object("/lib/dictionaries/racialDictionary.c");

if (!character->Race())
{
character->Race(member(personaBlueprints()[persona], "is humanoid") ?
racialDictionary->getRandomRace() : persona);
}
}

/////////////////////////////////////////////////////////////////////////////
public nomask void setupPersona(string persona, object character)
{
@@ -198,6 +211,7 @@ public nomask void setupPersona(string persona, object character)
{
if (minimumLevelMet(character, persona))
{
SetRace(character, persona);
SetStats(character);
SetPrimarySkills(character, persona);
SetSecondarySkills(character, persona);
@@ -303,3 +317,80 @@ public nomask object *getRandomEquipment(object persona, int chanceForMagicalIte
}
return equipment + ({});
}

/////////////////////////////////////////////////////////////////////////////
public nomask string getRandomPersona(string type)
{
string ret = type;
mapping blueprints = personaBlueprints();

switch (ret)
{
case "outlaw":
case "ruffian":
{
string *personas = filter(m_indices(blueprints),
(: $2[$1]["category"] == "fighters" :), blueprints);
personas -= ({ "knight", "phaedra", "knight of the storm" });

ret = personas[random(sizeof(personas))];
}
case "magic user":
{
string *personas = filter(m_indices(blueprints),
(: $2[$1]["category"] == "mages" :), blueprints);

ret = personas[random(sizeof(personas))];
}
case "dragon":
{
string *personas = filter(m_indices(blueprints),
(: $2[$1]["category"] == "dragons" :), blueprints);

ret = personas[random(sizeof(personas))];
}
case "creature":
{
string *personas = filter(m_indices(blueprints),
(: $2[$1]["category"] == "creatures" :), blueprints);

ret = personas[random(sizeof(personas))];
}
case "undead":
{
string *personas = filter(m_indices(blueprints),
(: $2[$1]["category"] == "undead" :), blueprints);

ret = personas[random(sizeof(personas))];
}
case "hunter":
{
ret = random(2) ? "archer" : "crossbowman";
}
}
return ret;
}

/////////////////////////////////////////////////////////////////////////////
public nomask int getValidLevel(string persona, int level, object target)
{
int ret = (level > 0) ? level : 1;

mapping blueprints = personaBlueprints();

if (member(blueprints, persona) &&
(member(inherit_list(target), "lib/realizations/henchman.c") == -1))
{
if (member(blueprints[persona], "minimum level") &&
(ret < blueprints[persona]["minimum level"]))
{
ret = blueprints[persona]["minimum level"];
}
else if (member(blueprints[persona], "maximum level") &&
(ret > blueprints[persona]["maximum level"]))
{
ret = blueprints[persona]["maximum level"];
}
}
return ret;
}

0 comments on commit b771ea6

Please sign in to comment.
You can’t perform that action at this time.