User Tools

Site Tools


mr:doctor_class

Doctor Class - Code References

Doctor Class

Java Classes

  • HeroClass.java - DOCTOR enum definition (line with DOCTOR(R.string.HeroClass_Doctor, DoctorArmor.class))
  • HeroClass.attackSkillBonus() - Bone Saw accuracy penalty (-5 attack skill when not wielding Bone Saw, 5% chance to warn per attack)
  • Hero.java - Hero base class with class-specific initialization
  • DoctorArmor.java - Class-specific armor

JSON Configuration

Starting configuration in initHeroes.json:

"DOCTOR": {
    "weapon": {
      "kind": "BoneSaw",
      "identified": true
    },
    "ring1": {
      "kind": "PlagueDoctorMask"
    },
    "armor": {
      "kind": "NoItem"
    },
    "knownItems": [
      { "kind": "PotionOfHealing" },
      { "kind": "PotionOfToxicGas" },
      { "kind": "PotionOfParalyticGas" }
    ]
}

String Resources

English string resources:

<string name="HeroClass_Doctor">Plague Doctor</string>
<string name="Accuracy_DecreasedDoctor">Accuracy decreased with %s</string>
<string name="Accuracy_DecreasedDoctorBareHands">Accuracy decreased while barehanded</string>

Lua Scripts

This entity is implemented in Java. No Lua script exists for the Doctor hero class.

Key Code Fragments

Java Implementation (HeroClass.java - DOCTOR enum):

DOCTOR(R.string.HeroClass_Doctor, DoctorArmor.class);

Attack Skill Bonus (Bone Saw Requirement):

@Override
public int attackSkillBonus(Char chr) {
    switch (this) {
        case DOCTOR:
            if(!chr.getActiveWeapon().getEntityKind().equals(BONE_SAW) 
                && !chr.getSecondaryWeapon().getEntityKind().equals(BONE_SAW)) {
                if(Math.random()<0.05) {
                    Item badWeapon = chr.getActiveWeapon();
                    if (!badWeapon.valid()) {
                        badWeapon = chr.getSecondaryWeapon();
                    }
                    if(badWeapon.valid()) {
                        chr.yell(Utils.format(R.string.Accuracy_DecreasedDoctor, badWeapon.name()));
                    } else {
                        chr.yell(R.string.Accuracy_DecreasedDoctorBareHands);
                    }
                }
                return -5;
            }
    }
    return 0;
}

mr/doctor_class.txt · Last modified: by 127.0.0.1