using RimWorld;
using Verse;
using Verse.AI;
namespace BlaxLaws
{
///
/// One act as a hook saw it, handed to CaseFiler.Report. Hooks build it only after their Watch flag and
/// Watch.MayMatch passed, so an empty lawbook allocates nothing. Never saved.
///
/// What each category puts in def: Break the MentalStateDef, Ate the eaten ThingDef, Used the used
/// ThingDef, Interaction the InteractionDef, RecordedAct the HistoryEventDef, Record the RecordDef, Bill
/// the RecipeDef, Special the ActDef.
///
public sealed class ActEvent
{
/// The category id (ActCategories).
public string categoryId;
/// The def the act is about; see the class summary.
public Def def;
/// Who did it. Filtered by Offenders.IsCovered inside Report.
public Pawn offender;
/// Who it was done to, when there is someone (the insulted pawn, the provoker of a fight).
public Pawn victim;
/// The thing involved (the eaten stack, the used item, the corpse), when there is one. May be destroyed by now.
public Thing thing;
/// The drug's chemical (a dose), or the binge's chosen chemical (hook A on a drug binge).
public ChemicalDef chemical;
/// The drug's category (a dose), or the binge's (MentalState_BingingDrug.drugCategory).
public DrugCategory drugCategory;
/// What the hook read from the thing for thing-level groups (hook C's prefix).
public ActFacts facts;
/// Notes the case takes over (on a table, dug up).
public CaseNotes notes;
/// The live mental state: the new one for a Break report, else null (Report reads the offender's).
public MentalState mentalState;
public ActEvent()
{
}
public ActEvent(string categoryId, Def def, Pawn offender)
{
this.categoryId = categoryId;
this.def = def;
this.offender = offender;
}
public override string ToString() =>
categoryId + "/" + (def?.defName ?? "null") + " by " + (offender?.LabelShort ?? "nobody") + (victim != null ? " on " + victim.LabelShort : "");
}
}