<commit_before>package com.planet_ink.coffee_mud.Abilities.Properties;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.CMClass.CMObjectType;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.MaskingLibrary;
import com.planet_ink.coffee_mud.Libraries.interfaces.MaskingLibrary.CompiledZMask;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

/*
   Copyright 2001-2020 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
public class Prop_HaveAdjuster extends Property implements TriggeredAffect
{
	@Override
	public String ID()
	{
		return "Prop_HaveAdjuster";
	}

	@Override
	public String name()
	{
		return "Adjustments to stats when owned";
	}

	@Override
	protected int canAffectCode()
	{
		return Ability.CAN_ITEMS;
	}

	@Override
	public boolean bubbleAffect()
	{
		return true;
	}

	protected Object[]		charStatsChanges	= null;
	protected Object[]		charStateChanges	= null;
	protected Object[]		phyStatsChanges		= null;
	protected CompiledZMask	mask				= null;
	protected boolean		multiplyPhyStats	= false;
	protected boolean		multiplyCharStates	= false;
	protected boolean		firstTime			= false;
	protected String[]		parameters			= new String[] { "", "" };
	private static String[]	allParms			= null;

	@Override
	public long flags()
	{
		return Ability.FLAG_ADJUSTER;
	}

	@Override
	public int triggerMask()
	{
		return TriggeredAffect.TRIGGER_GET;
	}

	public boolean addIfPlussed(final Map<String,String> ps, final String newText, final String parm, final int parmCode, final ArrayList<Object> addTo, final List<String> errors)
	{
		if(ps.containsKey(parm))
		{
			final String val=ps.get(parm);
			if(val.startsWith("+")
			&&(CMath.isNumber(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_int(val.substring(1))));
				return true;
			}
			else
			if(val.startsWith("-")
			&&(CMath.isNumber(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_int(val)));
				return true;
			}
			else
			if(val.startsWith("+")
			&&(CMath.isMathExpression(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression(val)));
				return true;
			}
			else
			if(val.startsWith("-")
			&&(CMath.isMathExpression(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression(val)));
				return true;
			}
			else<commit_msg>Prop_HaveAdjuster support for math expressions<commit_after>package com.planet_ink.coffee_mud.Abilities.Properties;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.CMClass.CMObjectType;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.MaskingLibrary;
import com.planet_ink.coffee_mud.Libraries.interfaces.MaskingLibrary.CompiledZMask;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

/*
   Copyright 2001-2020 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
public class Prop_HaveAdjuster extends Property implements TriggeredAffect
{
	@Override
	public String ID()
	{
		return "Prop_HaveAdjuster";
	}

	@Override
	public String name()
	{
		return "Adjustments to stats when owned";
	}

	@Override
	protected int canAffectCode()
	{
		return Ability.CAN_ITEMS;
	}

	@Override
	public boolean bubbleAffect()
	{
		return true;
	}

	protected Object[]		charStatsChanges	= null;
	protected Object[]		charStateChanges	= null;
	protected Object[]		phyStatsChanges		= null;
	protected CompiledZMask	mask				= null;
	protected boolean		multiplyPhyStats	= false;
	protected boolean		multiplyCharStates	= false;
	protected boolean		firstTime			= false;
	protected String[]		parameters			= new String[] { "", "" };
	private static String[]	allParms			= null;

	@Override
	public long flags()
	{
		return Ability.FLAG_ADJUSTER;
	}

	@Override
	public int triggerMask()
	{
		return TriggeredAffect.TRIGGER_GET;
	}

	public boolean addIfPlussed(final Map<String,String> ps, final String newText, final String parm, final int parmCode, final ArrayList<Object> addTo, final List<String> errors)
	{
		if(ps.containsKey(parm))
		{
			final String val=ps.get(parm);
			if(val.startsWith("+")
			&&(CMath.isNumber(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_int(val.substring(1))));
				return true;
			}
			else
			if(val.startsWith("-")
			&&(CMath.isNumber(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_int(val)));
				return true;
			}
			else
			if(val.startsWith("+")
			&&(CMath.isMathExpression(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression(val.substring(1))));
				return true;
			}
			else
			if(val.startsWith("-")
			&&(CMath.isMathExpression(val.substring(1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression(val.substring(1))));
				return true;
			}
			else
			if(val.startsWith("+'")
			&& val.endsWith("'")
			&&(CMath.isMathExpression(val.substring(2,val.length()-1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression(val.substring(2,val.length()-1))));
				return true;
			}
			else
			if(val.startsWith("-'")
			&& val.endsWith("'")
			&&(CMath.isMathExpression("-"+val.substring(2,val.length()-1))))
			{
				addTo.add(Integer.valueOf(parmCode));
				addTo.add(Integer.valueOf(CMath.s_parseIntExpression("-"+val.substring(2,val.length()-1))));
				return true;
			}
			else
{'fraction_non_alphanumeric': 0.12222917971195993, 'fraction_numerical': 0.005510331872260488, 'mean_word_length': 4.538141470180305, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6817173', 'n_tokens_mistral': 3030, 'n_tokens_neox': 2717, 'n_words': 531}