Skip to content

Commit

Permalink
Fold Everything and Morph Traits/Implants lookup (via API)
Browse files Browse the repository at this point in the history
- Every description section is now foldable, with a consistent look and behaviour. Fixes #46 and fixes #51
- If using the API Script, a button now allows lookup of (active) Morph Traits and Implants in the EPCompendium
- Added a special roll for Psychic Stab Damage to the Psi tab
  • Loading branch information
Bathtor committed Jul 8, 2018
1 parent 0937d07 commit 689a9de
Show file tree
Hide file tree
Showing 20 changed files with 189 additions and 99 deletions.
2 changes: 1 addition & 1 deletion model/epmodel.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name := "EP Model Root"

organization in ThisBuild := "com.lkroll.ep"

version in ThisBuild := "1.7.3"
version in ThisBuild := "1.8.0"

scalaVersion in ThisBuild := "2.12.4"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ object CharacterTraitSection extends RepeatingSection {
val traitName = text("name");
val traitType = "type".options(TraitType).default(TraitType.Neutral);
val traitTypeShort = text("type_short").editable(false);
val showDescription = flag("show_description").default(false);
val description = text("description");
}

Expand Down Expand Up @@ -65,6 +66,7 @@ object DerangementSection extends RepeatingSection {
val conditionName = text("name");
val severity = "severity".options(DerangementSeverity).default(DerangementSeverity.Minor);
val description = text("description");
val showDescription = flag("show_description").default(false);
val duration = "duration".default(0.0).validIn(0.0, 24.0, 0.5);
}

Expand All @@ -77,5 +79,6 @@ object DisorderSection extends RepeatingSection {

val conditionName = text("name");
val description = text("description");
val showDescription = flag("show_description").default(false);
val treatmentRemaining = "treatment_remaining".default(40).validIn(0, 40, 1);
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ object EPCharModel extends SheetModel {
val morphVisibleGender = text("visible_gender").editable(false);
val morphVisibleAge = text("visible_age").editable(false);
val morphTraits = "morph_traits".editable(false).default("");
//val morphLookupTraits = "morph_traits_lookup".default(false);
val morphImplants = "morph_implants".editable(false).default("");
//val morphLookupImplants = roll("implant_lookup", APIButton.)
val morphMobilitySystem = "morph_mobility_system".editable(false).default("Walker 4/20");
val morphDurability = "morph_durability".editable(false).default(0);
val morphArmourEnergy = "morph_armour_energy".editable(false).default(0);
Expand Down Expand Up @@ -217,6 +219,7 @@ object EPCharModel extends SheetModel {
val targetStrainQuery = targetStrainQueryRaw.expr.label("sentience mod");
lazy val psiChi = PsiChiSection;
lazy val psiGamma = PsiGammaSection;
val psychicStabDamage = roll("psychic-stab-damage", 1.d(10) + ceil(wilTotal / 10) + extraDamageQuery.arith);

// MUSE
val museName = text("muse_name");
Expand Down Expand Up @@ -259,6 +262,7 @@ object EPCharModel extends SheetModel {
val chatOutputOther = "chat_output_other".default(Chat.Default);
val chatOutputEPRolls = "chat_output_ep_rolls".default(Chat.Default);
val chatOutputSelect = "chat_output_select".options(ChatOutput).default(ChatOutput.Public);
val usingAPIScript = "using_api_script".default(false);

val globalMods = (miscActionMod - woundTraumaMods + psiSustainedMod).paren;
val globalPhysicalMods = (globalMods + miscPhysicalMod + layeringPenalty).paren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ object EPTranslation extends SheetI18N {
val strainMod = text("psi-strain-mod");
val strain = text("strain");
val psiSkill = text("psi-skill");
val psychicStab = text("psychic-stab");
val psychicDamage = text("psychic-damage");

// muse
val muse = text("muse");
Expand Down Expand Up @@ -317,6 +319,8 @@ object EPTranslation extends SheetI18N {
val miscInitiativeMod = text("misc-initiative-mod");
val miscDurBonus = text("misc-dur-bonus");
val chatOutput = text("chat-output");
val usingAPIScript = text("using-api-script");
val apiLookup = text("api-lookup");

// template
val rollsfor = text("rolls-for");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ object ArmourItemSection extends RepeatingSection {
val accessory = flag("accessory").default(false);
val energyBonus = "energy_bonus".default(0).validIn(0, 999, 1);
val kineticBonus = "kinetic_bonus".default(0).validIn(0, 999, 1);
val showDescription = flag("show_description").default(false);
val description = text("description");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object PsiChiSection extends RepeatingSection {
val duration = "duration".default("Constant");
val strainMod = "strain_mod".default(0);
val strainDamage = roll("strain_damage", ceil(Dice.d10.arith / 2) + strainMod); // Chi never targets others, and the user can hardly be below full sentience, thus no targetStrainQuery
val showDescription = flag("show_description").default(false);
val description = text("description");
}

Expand All @@ -64,5 +65,6 @@ object PsiGammaSection extends RepeatingSection {
val skillName = "skill_name".editable(false).default("None");
val skillTotal = "skill_total".ref(EPCharModel.activeSkills.total);
val attackTarget = roll("attack_target", EPCharModel.targetQuery.arith + EPCharModel.modQuery.arith + skillTotal.altArith + EPCharModel.globalMods);
val showDescription = flag("show_description").default(false);
val description = text("description");
}
2 changes: 1 addition & 1 deletion script/epapiscript.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ scalaVersion := "2.12.4"

libraryDependencies += "com.lkroll.roll20" %%% "roll20-api-framework" % "0.8.+"
libraryDependencies += "com.lkroll.ep" %%% "epcompendium-core" % "2.1.1"
libraryDependencies += "com.lkroll.ep" %%% "ep-model" % "1.7.3"
libraryDependencies += "com.lkroll.ep" %%% "ep-model" % "1.8.0"
libraryDependencies += "com.lihaoyi" %%% "fastparse" % "1.+"
libraryDependencies += "org.rogach" %%% "scallop" % "3.1.+"
libraryDependencies += "org.scalactic" %%% "scalactic" % "3.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,26 @@ object EPCompendiumDataCommand extends APICommand[EPCompendiumDataConf] {
val results = EPCompendium.findAnything(needle);
handleResults(results, config, ctx);
} else if (config.multiSearch.isSupplied) {
ctx.reply(s"Searching for multiple items in whole Compendium...");
val needles = config.multiSearch().split(",");
val results = needles.map { needle =>
val r = EPCompendium.findAnything(needle.trim).headOption.map { bestResult =>
val infoButton = this.invoke("?", argumentFrom(bestResult, config)).render;
s"${bestResult.templateTitle} ${infoButton}"
val s = config.multiSearch().trim;
if (s.isEmpty()) {
ctx.reply(s"Ignoring empty search.");
} else {
ctx.reply(s"Searching for multiple items in whole Compendium...");
val needles = s.split(",");
val results = needles.map { needle =>
val r = EPCompendium.findAnything(needle.trim).headOption.map { bestResult =>
val infoButton = this.invoke("?", argumentFrom(bestResult, config)).render;
s"${bestResult.templateTitle} ${infoButton}"
};
(needle, r)
};
(needle, r)
};
val pretty = results.map {
case (needle, Some(r)) => s"<b>${needle}</b> &rarr; $r"
case (needle, None) => s"<b>${needle}</b> &rarr; 404 Not Found"
}.mkString("<ul><li>", "</li><li>", "</li><ul>");
debug(s"About to send '$pretty'");
ctx.reply(pretty);
val pretty = results.map {
case (needle, Some(r)) => s"<b>${needle}</b> &rarr; $r"
case (needle, None) => s"<b>${needle}</b> &rarr; 404 Not Found"
}.mkString("<ul><li>", "</li><li>", "</li><ul>");
debug(s"About to send '$pretty'");
ctx.reply(pretty);
}
} else if (config.weapon.isSupplied && !config.withAmmo.isSupplied) {
val needle = config.weapon();
ctx.reply(s"Searching for '$needle' in weapons...");
Expand Down
2 changes: 1 addition & 1 deletion sheet/epsheet.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name := "EP Sheet Root"

organization in ThisBuild := "com.lkroll.ep"

version in ThisBuild := "1.7.3"
version in ThisBuild := "1.8.0"

scalaVersion in ThisBuild := "2.12.4"

Expand Down
4 changes: 4 additions & 0 deletions sheet/js/src/main/scala/com/lkroll/ep/sheet/EPUpdates.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ object EPUpdates extends MinorVersionUpdateManager {
val assignDMax = op(model.durability).update(dur => Seq(model.damageMax <<= dur));
List(assignDMax)
}
forVersion("1.7.0") {
val calc = nop { _: Option[Unit] => EPWorkers.chatOutputCalc().map(_ => ()) }; // workaround for initialisation timing
List(calc)
}
}
12 changes: 6 additions & 6 deletions sheet/js/src/main/scala/com/lkroll/ep/sheet/EPWorkers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ object EPWorkers extends SheetWorkerRoot {
case (targetS) => {
import ChatOutput._;
val target = ChatOutput.withName(targetS);
val (ccep, cco) = target match {
case Public => (Chat.Default, Chat.Default)
case GM => (Chat.GM, Chat.GM)
case PublicScript => (Chat.API("eproll", ""), Chat.Default)
case GMScript => (Chat.API("eproll", "-o GM"), Chat.GM)
val (ccep, cco, api) = target match {
case Public => (Chat.Default, Chat.Default, false)
case GM => (Chat.GM, Chat.GM, false)
case PublicScript => (Chat.API("eproll", ""), Chat.Default, true)
case GMScript => (Chat.API("eproll", "-o GM"), Chat.GM, true)
};
Seq(chatOutputEPRolls <<= ccep, chatOutputOther <<= cco)
Seq(chatOutputEPRolls <<= ccep, chatOutputOther <<= cco, usingAPIScript <<= api)
}
}

Expand Down
14 changes: 11 additions & 3 deletions sheet/jvm/src/main/resources/WEB-INF/defaults.css
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ span.sheet-h2hr:after {

.sheet-presentation span {
color: ${input-colour};
white-space: pre-wrap;
/*white-space: pre-wrap; doesn't seem to behave nicely*/
}

/*.sheet-left-top-corner {
Expand Down Expand Up @@ -474,8 +474,8 @@ span.sheet-skillSpec:not(:empty)::before {
line-height: 1.4em;
margin-top: 0px;
margin-bottom: -1px;
margin-left: 0px;
margin-right: 3px;
margin-left: 0.5em;
margin-right: 0px;
}

.sheet-toggle-wrapper-label input {
Expand Down Expand Up @@ -526,6 +526,14 @@ input.sheet-divide-not-one:checked~.sheet-divisor::before {
content: "%";
}

input.sheet-using-api[value="on"]+.sheet-api-only {
display: initial;
}

input.sheet-using-api[value="0"]+.sheet-api-only {
display: none;
}

/*
*
* ROLL TEMPLATE
Expand Down
34 changes: 23 additions & 11 deletions sheet/jvm/src/main/scala/com/lkroll/ep/sheet/CoreTab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ object CoreTab extends FieldGroup {
TightRepRow(
presOnly(
flowrow(
char.effects.showDescription.like(CoreTabRenderer.descriptionToggleWrapped),
char.effects.active,
char.effects.effectName.like(GearTab.rowItemName),
span("["), char.effects.duration, span("] "),
char.effects.gameEffect,
char.effects.showDescription.like(CoreTabRenderer.descriptionToggleWrapped),
flexFill),
indentpar(
char.effects.showDescription.like(CoreTabRenderer.descriptionToggle),
Expand All @@ -87,11 +87,15 @@ object CoreTab extends FieldGroup {
t.characterTraits,
char.characterTraits {
TightRepRow(
presOnly(flowpar(
presOnly(
flowpar(
char.characterTraits.traitTypeShort.like(traitTypeRenderer),
char.characterTraits.traitName.like(GearTab.rowItemName),
char.characterTraits.description.like(CoreTabRenderer.inlineDescription),
flexFill)),
char.characterTraits.showDescription.like(CoreTabRenderer.descriptionToggleWrapped),
flexFill),
indentpar(
char.characterTraits.showDescription.like(CoreTabRenderer.descriptionToggle),
char.characterTraits.description.like(CoreTabRenderer.description))),
editOnly(tightfrow(
char.characterTraits.traitType,
char.characterTraits.traitName.like(CoreTabRenderer.textWithPlaceholder(t.traitName.placeholder)),
Expand All @@ -103,12 +107,16 @@ object CoreTab extends FieldGroup {
t.derangements,
char.derangements {
TightRepRow(
presOnly(flowpar(
presOnly(
flowpar(
char.derangements.conditionName.like(GearTab.rowItemName),
span("["), char.derangements.duration.like(CoreTabRenderer.presEditableNum), span(t.hours), span("] "),
span("("), char.derangements.severity, span(") "),
char.derangements.description.like(CoreTabRenderer.inlineDescription),
flexFill)),
span("("), char.derangements.severity, span(")"),
char.derangements.showDescription.like(CoreTabRenderer.descriptionToggleWrapped),
flexFill),
indentpar(
char.derangements.showDescription.like(CoreTabRenderer.descriptionToggle),
char.derangements.description.like(CoreTabRenderer.description))),
editOnly(tightfrow(
char.derangements.conditionName.like(CoreTabRenderer.textWithPlaceholder(t.equipmentName.placeholder)),
(t.derangementDuration -> char.derangements.duration), span(t.hours),
Expand All @@ -121,12 +129,16 @@ object CoreTab extends FieldGroup {
t.disorders,
char.disorders {
TightRepRow(
presOnly(flowpar(
presOnly(
flowpar(
char.disorders.conditionName.like(GearTab.rowItemName),
span(raw(" ~ ")), span(EPStyle.subtleInlineLabel, t.disorderRemainingTreatment),
char.disorders.treatmentRemaining.like(CoreTabRenderer.presEditableNum), span(t.hours),
char.disorders.description.like(CoreTabRenderer.inlineDescription),
flexFill)),
char.disorders.showDescription.like(CoreTabRenderer.descriptionToggleWrapped),
flexFill),
indentpar(
char.disorders.showDescription.like(CoreTabRenderer.descriptionToggle),
char.disorders.description.like(CoreTabRenderer.description))),
editOnly(tightfrow(
char.disorders.conditionName.like(CoreTabRenderer.textWithPlaceholder(t.equipmentName.placeholder)),
(t.disorderRemainingTreatment -> char.disorders.treatmentRemaining), span(t.hours),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ object EPDamageTemplate extends RollTemplate {
val t = EPTranslation;
val sty = EPStyle;

def strain(cf: Field[String], af: Field[String], rf: RollField[Int], de: LabelI18N): TemplateApplication =
apply(character <<= cf, attributeField <<= af, damageRoll <<= rf, damageExplanation <<= de)
def explained(cf: Field[String], af: Field[String], rf: RollField[Int], de: LabelI18N): TemplateApplication =
apply(character <<= cf, attributeField <<= af, damageRoll <<= rf, damageExplanation <<= de);

def explained(cf: Field[String], al: LabelI18N, rf: RollField[Int], de: LabelI18N): TemplateApplication =
apply(character <<= cf, attributeLabel <<= al, damageRoll <<= rf, damageExplanation <<= de);

def apply(cf: Field[String], al: LabelI18N, rf: RollField[Int]): TemplateApplication =
apply(character <<= cf, attributeLabel <<= al, damageRoll <<= rf)
apply(character <<= cf, attributeLabel <<= al, damageRoll <<= rf);

def apply(cf: Field[String], af: Field[String], rf: RollField[Int], dtf: Field[String], apf: Field[Int]): TemplateApplication =
apply(character <<= cf, attributeField <<= af, damageRoll <<= rf, damageType <<= dtf, armourPenetration <<= apf);

def apply(cf: Field[String], af: Field[String], rf: RollField[Int], dtf: Field[String], apf: Field[Int], xdbf: CommandButton, xdfa: CommandButton): TemplateApplication =
apply(character <<= cf, attributeField <<= af, damageRoll <<= rf, damageType <<= dtf, armourPenetration <<= apf, concentrateBF <<= xdbf, concentrateFA <<= xdfa)
apply(character <<= cf, attributeField <<= af, damageRoll <<= rf, damageType <<= dtf, armourPenetration <<= apf, concentrateBF <<= xdbf, concentrateFA <<= xdfa);

// **** Fields ****
val character = attribute[String]("character");
Expand Down
2 changes: 2 additions & 0 deletions sheet/jvm/src/main/scala/com/lkroll/ep/sheet/EPStyle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ object EPStyle extends SheetStyle {
val divisor = cls();

val identities = cls();
val `api-only` = cls();
val `using-api` = cls();

// *** Templates ***

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ Only one full-auto attack may be made with each Complex Action. This attack may
val strainMod = keys.strainMod <~ "Strain Mod";
val strain = keys.strain <~ "Strain";
val psiSkill = keys.psiSkill <~ "Skill";
val psychicStab = keys.psychicStab <~ "Psychic Stab Damage";
val psychicDamage = keys.psychicDamage <~ "Psychic";

// muse
val muse = keys.muse <~ "Muse";
Expand Down Expand Up @@ -393,6 +395,8 @@ Only one full-auto attack may be made with each Complex Action. This attack may
case ChatOutput.PublicScript => "Public via API"
case ChatOutput.GMScript => "Whisper to GM via API"
}
val usingAPIScript = keys.usingAPIScript <~ "Use API Script?";
val apiLookup = keys.apiLookup <~ "Lookup";
// ****************
// ADD OPTIONS HERE
// ****************
Expand Down
Loading

0 comments on commit 689a9de

Please sign in to comment.