Sorcery Clans rebirth!

Expecting to compile. Time to make a wish list!

  • Fix the save file team bug obv (check, I think)
  • Add new research results (check!)
    • Artifacts, beasts, spirits, powers, and lesser & greater undead!
  • Fixed some bugs:
    • No update of magical research when artifact is added
    • Fix artifact removal? Might have fixed it…
    • Fix spy double-counting
  • Attenuate power gain for high power soldiers **
  • Fix the perimeter detection system which currently is broken-ish (check!!)
  • Able to put powers on someone on a team (check)
  • Sending teams mid-month to attempt a taming (check)
    • Related, making artifacts not count for taming (check)
  • Restructures:
    • MIDMONTH PT1: Tame beasts in the middle of the month, and able to cast power spells on soldiers on teams (check)
    • MIDMONTH PT2: Anytime a spell finishes (minion or power), give a SpellMenu to select the next spell or get to research (check!) (this will be the finalization of V1.1.2)
    • MIDMONTH PT3: Add casting times for taming tools, lesser undead tools, and greater undead tools (also create greater undead tools, and require the caster to be on the research team). Then add these spells to the SpellMenu. This will require going to V1.2.0 Also a minor addition, printing on Research’s #1 option the status of research and the target spell being cast (ALL DONE!)
  • Also I just had an infinite loop bug in my end of the year -_- Gotta find it! Could be in the academy, research, or something else completely >_< …. could not replicate. Booooo. I have a feeling it was in the academy based on where it was hanging, but I need to go through that and the Rival sections with fine tooth combs at some point….
  • Additional tweak to complete 1.2.0: why is research free??
    • Have some ability to assign $$ towards research (to make it go faster? Probably just to keep it from being super slow)
    • Supposing that with $0, discoveries are completely impossible, but even with infinite money the pace of research is limited by the number of magical warm bodies
      • This would also justify having prototype tools come with the discovery, and it was always weird to have this artifact core that you just spent a ton of money on to get an artifact. Maybe with this change the money to buy the artifact is less.
    • THEORETICAL SETUP:
      • Research points only “count” up to the limit set by the money being spent towards res.rp
      • The “budget” can be a flat monthly rate or it can be a percentage of need (up to 100%)
      • Need to figure out what the money/points ratio will be:
        • Since I really like research and it’s fun, I should not make the monetary value too high. Maybe for a discovery of $2,000,000 the financial cost should be $200,000. It’s still a lot but it’s totally doable (a single S-rank mission can pay that), but to add up to a bunch of research it means a bunch of extra S rank missions.
        • Maybe because of this, once the counter is above something, change the formula to slowly but surely weight the missions towards the higher end?
        • if a soldier has POW 5,000 and MAG 10 s/he contributes 50,000 magic points towards research per month, but only if the budget was at least $5,000. That’s really not that much, but it makes a lot more sense and makes it harder to hoard money and research discoveries at the same time.
      • Casting spells is free since they have their own cost, this is just for research
      • This will require modifying the save file (to save the pref) and the res.nextday function.
      • May want to think about another way to make money besides
      • This also makes spy research theft amazing since that doesn’t cost money, it’s added directly to res.rp (as it should, you are stealing someone else’s hard work).
  • New project: Hospital!
    • This won’t be until probably 1.3.0, but the way I envision it is adding a random affinity for healing to every power that has magic. Soldiers without powers add a fixed amount of healing once they’ve been trained (magic makes a lot more) (their training can elevate them) (each soldier should have a semi-hidden affinity for medicine that is only discovered by seeing how fast they graduate to some higher rank and only viewable through the hospital)
      • The Hospital object (or more likely an add-on to the Defense object, for ease of switching soldiers over) would hold the training scores of all soldiers who have had the training, so they can leave and still come back to be more helpful (unless they’re undead)
      • If the soldier has a power that gives a high affinity for healing they add a lot more points of healing per day
        • The sum total of soldier healing powers create a certain number of HP points per day that can be added to wounded soldier HP until they’re fully healed. This will REPLACE the currently hospital mechanic where all soldiers gain 1HP/2 days, the goal would be that a typical village humming along at normal status would have approx. that level of healing available but could boost it when needed (like in war…)
        • Also soldiers who are idle will no longer heal at all, or else even more slowly than they do now.
      • Teams should be able to be added to the hospital but they won’t do much good unless some of their soldiers have hospital training. Then the whole team can add that hospital training times the twf (mwahaha)
      • The hospital should have an ability to list the top healing soldiers not on the hospital team (like a top 10 ranking) so you know where to go first if you need more help
      • The Hospital has options for healing priorities: stronger soldiers first, higher stat soldiers first, weaker soldiers first, most damaged soldiers first, or egalitarianism
      • Hospital medical ranks: Initiate, Intern, Medic, Doctor, Surgeon
      • Medic, Doctor, Surgeon are separate ranks that show up in the Rank column and come with higher pay
      • All healing ability destroyed if they become a Necromancer
    • This immediately springs to mind that the training accrues day by day and at the end of the month there may be a level up by medical team, including asking what specialty
      • Medical research squad can only be joined by medical staff and add pool equal to their medical training to the research pool. Also the research can be focused on either Surgery, Apothecary research or Alchemy research (or both, like other researches)
      • Surgery improves the ability to heal soldiers with serious injuries.
      • Apothecary can concoct medicines that can be mass produced and are widely useful, so give small and relatively cheap bonuses to all healings
      • Alchemist can boost stats, but each alchemy comes with a limitation. For example, can increase Combat by 1, but only up to a limit of 5. Can increase HP, but only up to a limit of 10. Things like that. Also each alchemy spell has a limitation of who can use it and how much it costs in both money and energy
    • Hospital medical ranks do NOT contribute to success on other missions, though maybe Hospital missions can be created separately to send medical teams on?? Maybe???
    • Soldiers may gain a little power from working medicine but in general it should be a separate path (they should also be paid more for their medical ranks!)

I’M EXCITED TO DO IT!!!! But first I’m going to do the Parts 2 and 3 Midmonth project, so I don’t think I’ll get to this part until later, maybe summer? But possibly next weekend :3

Update 4/25: Finished 1.2.0, going to start the hospital project. FIRST, have to define what happens if a Soldier is injured and receives NO CARE.

  • Soldiers all have a boolean added to their data called stable
    • If it is false, the soldier’s body is seriously injured and attempting further action can cause further damage
    • Stability damage will always be a percentage plus a small number (so 20%+2 dmg, so that soldiers with only 5hp are in mortal danger, while soldiers with 20hp aren’t that badly affected but it’s more total damage to them than a rookie)
    • Stability suggests internal injuries and severely broken bones, that can linger and even kill without treatment
  • Stability activates as a percentage chance whenever the soldier is more than 50% injured, even if the injury is old
  • Stability also activates automatically if a soldier takes more than a certain percent damage (say 50%) in a single event. This has to be handled in sList.
  • If a soldier is stable, they heal very slowly (1hp per 5 days) so long as they or their team is not doing anything.
  • If a soldier is unstable they will not heal, and continue to occasionally lose HP even while doing nothing
    • Soldier status should say “Injured” when they are unstable
    • Soldier contributions to teams should also be affected (maybe divided by 5 since this is supposed to be a crippling situation)
  • Soldiers or teams that have injured soldiers can be sent to the hospital, which exists by default even with 0 money, but let’s explore what a 0 money hospital is like
    • No medical staff (maybe recruit a civilian medic automatically), no materials like bandages, no tools for surgery and no medicine to treat poisons or dull pain. So basically you’re on bedrest and maybe you’ll get better, maybe you won’t
      • Results in a 10% chance per day of stabilizing, doesn’t cause any extra damage but they can still accumulate damage while not stabilized
      • No other healing can happen
      • Limited number of beds (start with some default number like 5) and any extra unstable soldiers simply get bounced out (maybe form a waiting list)
  • Hospital money is in two categories:
    • Equipment (beds, surgery tools, magical healing tools)
    • Supplies (bandages, medicines, magical materials for healing spells)
    • The first can be bought with the Defense menu for equipment (no need to get granular), the second is like the research where you can choose to fund a percentage or a flat limit.
  • Once a hospital budget exists (and some soldiers have started to train as medics), medics can work (alone or in teams) to stabilize and heal injured soldiers
    • Medics with certain skill have higher percentage chance to stabilize Injured soldiers, and also can heal a certain number of points per day in totality
    • For example, the maximum number of HP healing dispensed by a medic with medskill 5 and medpower 100 might be only 1HP/day, but a medic with medskill 10 and medpower 1000 could be as good as 20/day, but only with access to magical healing, without magical healing even 2/day is pretty unrealistic
    • Additionally, the number of soldiers a medic can stabilize is going to be 1/day for a while but could eventually get up to several per day if highly skilled and powerful
    • The marginal cost for increasing healing power (e.g. from 1/day to 2/day) is a variable associated with the hospital, determined by access to equipment and magic
    • The limit of how much healing power can be dispensed is also fixed by the equipment, since equipment includes magical spells the medics can cast and without any spells and surgery tools you’re mostly stuck waiting for the body to grow back
  • Finally, the Hospital also has to have priorities, since micromanaging the soldiers to do the healing individually is a level of insanity I’m not ready for.
    • Can choose to limit by $/day total, $/day per soldier, % requested, and any combination thereof. No limits will have every medic go up to their maximum healing on every soldier they can
    • Also have a setting for each medic to try and maximize healing on most injured soldier or to spread healing out, and a setting to allow medics to work together or to keep them spread out (allowing teamwork lets more healing happen, though there HAS to be diminishing returns on it, it can’t add linearly but will cost a lot more money, and supplies can run out). Also medics have a fatigue score that as it adds up, impedes their ability to work
    • Use a similar system to the research money to daily collect hospital expenses, use it in monthly display/calculations
  • Time to give it a shot!

Save file additions:

  • Soldier: boolean stable
  • moneys.hospitalbills
  • Hospital (or inside Defense): medics[ ][ ]
    • medics[i][0]: status //0==not on team, 1==active, 2==resting, etc.
    • medics[i][1]: soldier ID
    • medics[i][2]: medskill
    • medics[i][3]: medpower
    • medics[i][4]: magic
    • medics[i][5]: fatigue //starts at 0, subtracts 2 per day no activity, adds 1 per day of healing, when it gets to 5 starts subtracting fractionally from medskill

Memory organization:

  • Soldiers in hospital and in waiting room are in sList, and the sList daily returns a discharge list
  • Every day the Defense returns an array of healings beds (made from the equipment and medic stats) and determines how many people can be stabilized, and heals them etc., but the defense needs info on what soldiers are in the hospital in order to determine what
    • The defenses.healDay(int) works by SORTING the medic[i] array from highest to lowest medskill*medpower if active (and if fatigue is below threshold, those inactive or fatigued dribble to the end), then for loop through the array [through the actives only] to populate the beds
      • Three variables are all in play here: patients, beds, and medics
      • Healing CANNOT happen without a bed, so hopefully there are enough beds! But must be prepared for there not to be. Test 7 5 3 for each value and what to return, all medics have value 9
      • beds > medics > patients: return [9 9 9] //healing for all three patients
      • beds > patients > medics: return [9 9 9 0 0] //2 beds with no medic but still some chance to heal, unless maybe a setting for medics to spread out their skill??
      • medics > patients > beds: return [9 9 9] if no collaboration or [27 18 18] with collaboration
      • medics > beds > patients: return [9 9 9] if no collaboration or [27 18 18] with collaboration
      • patients > medics > beds: return [9 9 9] if no collaboration or [27 18 18] with collaboration
      • patients > beds > medics: return [9 9 9 9 9] if no collaboration or [18 18 9 9 9] if collaboration (
      • CONSIDER: since the number of patients is being passed in, is it really necessary to make empty beds with no patient? I don’t think so.
    • The sList can generate a total number of soldiers who have been sent to medical care (an integer) and this is fed into the defenses healing calculator
    • Preferences on how thin to stretch medical staff are in the defenses
    • The preferences on how to handle waitlisting and how much money to spend have to be stored in sList then
  • The sList.healing(defenses.healDay(sList.hospital())) returns an integer array, the first entry is how much money was spent that day, the rest of the array is IDs of soldiers who are released from hospital and can be activated (again according to settings)

More things about defenses.healDay(int):

  • The fatigue lessening and experience gain both need to be at the end of this function right before the return of the int[]
  • The surgery stations and runic healings add more healing to beds, but they are not beds themselves
  • Make three kinds of wings: general care wing and surgery wing
    • 20 beds per general practice wing
    • only 5 beds per surgery wing but 4 surgery stations and 1 magic station as well (when building a surgery station or a magic station, a bed is built as well automatically). This way, if (beds<=(20*u7+5*u8)) build bed; else H.pl(“build a new wing!”);

Medic options for defenses.healDay(int):

  • Collaborate: when medics > patients, do the medics use teamwork? Maybe just set a max group size, like 1 is always solo, 2 allows partners, etc (then run the loop repeatedly when medics > patients)
  • Multitask: when patients > medics, how may the medics split their skill? A medic with 10 points to heal shouldn’t be able to split them evenly, more like 3 and 3 since s/he’s not focused (divide by n+1 I guess?). Same as above, a setting for the maximum number of patients per medic
    • A medic with 10 healing splits as such:
    • 3 and 3 for two patients
    • 2, 2, and 2 for three patients
    • 2, 2, 2, and 2 for four patients
    • 1, 1, 1, 1, 1 for five patients.
    • even treatment of 0 should still have a chance to stabilize, which will happen at around 10 patients

Hospital options for sList.healing(int[])

  • percentage discharge (up to 100%, which means not discharged until fully healed)
    • Obviously can’t ever discharge an unstable soldier
    • Stabilizing is one of the first things to happen though!