public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType) { List <InputCondition> inputConditionsFromOC = outputChangeMappingType.EntityTypeInputConditions(); List <EntityType> entityTypes = TypeGroup.PossibleEntityTypes(inputConditionsFromOC, agent.memoryType.GetKnownEntityTypes(agent)); if (inputConditionMappingType.AnyEntityTypeMatchesTypeGroups(entityTypes) && inputCondition.levelType == outputChange.levelType) { // Same EntityType and same TagType - match adding tag to needing tag and removing tag to can't have tag if (!outputChange.boolValue && ((HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.DoesNotHaveOwnerTag || (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.DoesNotHaveTag)) { return(true); } else if (outputChange.boolValue && ((HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagButNotOwner || (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagIgnoreOwnership || (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagIsOwner)) { return(true); } } return(false); }
public override bool PreMatch(OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType, List <EntityType> allEntityTypes) { // Matches OtherInventoryAmountICT // This needs to be giving the corrent EntityType (InventoryGroupings) based on what the ICT needs (InventoryGroupings) if (outputChange.inventoryTypeGroupMatchIndex == -1) { return(false); } InputCondition outputChangeInputCondition = outputChangeMappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex]; List <TypeGroup> groupings = outputChangeInputCondition.InventoryTypeGroups(outputChangeMappingType, out List <int> indexesToSet); // groupings is now the EntityTypes that are possible to be given List <EntityType> entityTypes = TypeGroup.InAllTypeGroups(groupings, allEntityTypes); // See if any of these EntityTypes matches what the IC of OtherInventoryAmountICT needs bool inventoryGroupMatches = inputCondition.AnyInventoryGroupingMatches(inputConditionMappingType, entityTypes); // Also need to make sure that possible EntityTypes from both MappingTypes have some overlap bool groupMatches = outputChangeMappingType.AnyEntityTypeMatchesTypeGroups(inputConditionMappingType, allEntityTypes); if (inventoryGroupMatches && groupMatches) { return(true); } return(false); }
public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType) { List <InputCondition> inputConditionsFromOC = outputChangeMappingType.EntityTypeInputConditions(); List <EntityType> entityTypes = TypeGroup.PossibleEntityTypes(inputConditionsFromOC, agent.memoryType.GetKnownEntityTypes(agent)); if (inputConditionMappingType.AnyEntityTypeMatchesTypeGroups(entityTypes)) { return(true); } return(false); }
public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType) { // This matches WorldObjectStateICT List <InputCondition> inputConditionsFromOC = outputChangeMappingType.EntityTypeInputConditions(); List <EntityType> entityTypes = TypeGroup.PossibleEntityTypes(inputConditionsFromOC, agent.memoryType.GetKnownEntityTypes(agent)); if (inputConditionMappingType.AnyEntityTypeMatchesTypeGroups(entityTypes) && outputChange.stringValue == inputCondition.stringValue) { return(true); } return(false); }