<commit_before>package com.planet_ink.coffee_mud.Abilities.Skills;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
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.*;
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 2017-2017 <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 Skill_RevealText extends StdSkill
{
	@Override
	public String ID()
	{
		return "Skill_RevealText";
	}

	private final static String	localizedName	= CMLib.lang().L("Reveal Text");

	@Override
	public String name()
	{
		return localizedName;
	}

	@Override
	protected int canAffectCode()
	{
		return 0;
	}

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

	@Override
	public int abstractQuality()
	{
		return Ability.QUALITY_INDIFFERENT;
	}

	private static final String[]	triggerStrings	= I(new String[] { "REVEALTEXT" });

	@Override
	public String[] triggerStrings()
	{
		return triggerStrings;
	}

	@Override
	public int classificationCode()
	{
		return Ability.ACODE_SKILL | Ability.DOMAIN_STREETSMARTS;
	}

	@Override
	public int overrideMana()
	{
		return 0;
	}
	
	protected Item revealI=null;
	protected ItemPossessor possessorI=null;
	protected boolean success=false;
	protected String page="";
	protected int tickUp=0;

	protected boolean confirmSuccess()
	{
		final Physical P=affected;
		if(P instanceof MOB)
		{
			final MOB mob=(MOB)P;
			if((revealI==null)
			||(revealI.amDestroyed())
			||(revealI.owner()!=possessorI)
			||(!CMLib.flags().canBeSeenBy(revealI, mob)))
			{
				success = false;
				return false;
			}
		}
		else
		{
			success = false;
			return false;
		}
		return true;
	}

	public boolean tick(Tickable ticking, int tickID)
	{
		if(!super.tick(ticking, tickID))
			return false;
		if(tickID == Tickable.TICKID_MOB)
		{
			tickUp++;
			if(!confirmSuccess())
			{
				unInvoke();
				return false;
			}
			final Physical P=affected;
			if(P instanceof MOB)
			{
				final MOB mob=(MOB)P;
				if(tickDown==4)
					mob.location().show(mob,revealI,this,CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,L("<S-NAME> <S-IS-ARE> almost done revealing <T-NAME>."));
				else
				if((tickUp%4)==0)
				{
					final int total=tickUp+tickDown;
					final int pct=(int)Math.round(CMath.div(tickUp,total)*100.0);
					mob.location().show(mob,revealI,this,CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,L("<S-NAME> continue(s) revealing <T-NAME> (@x1% completed).",""+pct),null,L("<S-NAME> continue(s) decrypting <T-NAME>."));
				}
			}
		}
		return true;
	}
	
	@Override
	public void unInvoke()
	{
		final Physical P=affected;
		confirmSuccess();
		super.unInvoke();
		if(P instanceof MOB)
		{
			final MOB mob=(MOB)P;
			if(!success)
			{
				mob.tell(L("You've failed to reveal the text on @x1.",revealI.name(mob)));
			}
			else
			{
				mob.tell(L("You've completed releaving the text on @x1.",revealI.name(mob)));
				boolean killInvisibleInk=false;
				Ability encryptA=mob.fetchEffect("InvisibleInk");
				if(encryptA==null)
				{
					encryptA=revealI.fetchEffect("InvisibleInk");
					if(encryptA!=null)
					{
						killInvisibleInk=true;
						encryptA=(Ability)encryptA.copyOf();<commit_msg>Secret writing, invisible ink, skillcraft fixes<commit_after>package com.planet_ink.coffee_mud.Abilities.Skills;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
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.*;
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 2017-2017 <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 Skill_RevealText extends StdSkill
{
	@Override
	public String ID()
	{
		return "Skill_RevealText";
	}

	private final static String	localizedName	= CMLib.lang().L("Reveal Text");

	@Override
	public String name()
	{
		return localizedName;
	}

	@Override
	protected int canAffectCode()
	{
		return 0;
	}

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

	@Override
	public int abstractQuality()
	{
		return Ability.QUALITY_INDIFFERENT;
	}

	private static final String[]	triggerStrings	= I(new String[] { "REVEALTEXT" });

	@Override
	public String[] triggerStrings()
	{
		return triggerStrings;
	}

	@Override
	public int classificationCode()
	{
		return Ability.ACODE_SKILL | Ability.DOMAIN_STREETSMARTS;
	}

	@Override
	public int overrideMana()
	{
		return 0;
	}
	
	protected Item revealI=null;
	protected ItemPossessor possessorI=null;
	protected boolean success=false;
	protected String page="";
	protected int tickUp=0;

	protected boolean confirmSuccess()
	{
		final Physical P=affected;
		if(P instanceof MOB)
		{
			final MOB mob=(MOB)P;
			if((revealI==null)
			||(revealI.amDestroyed())
			||(revealI.owner()!=possessorI)
			||(!CMLib.flags().canBeSeenBy(revealI, mob)))
			{
				success = false;
				return false;
			}
		}
		else
		{
			success = false;
			return false;
		}
		return true;
	}

	public boolean tick(Tickable ticking, int tickID)
	{
		if(!super.tick(ticking, tickID))
			return false;
		if(tickID == Tickable.TICKID_MOB)
		{
			tickUp++;
			if(!confirmSuccess())
			{
				unInvoke();
				return false;
			}
			final Physical P=affected;
			if(P instanceof MOB)
			{
				final MOB mob=(MOB)P;
				if(tickDown==4)
					mob.location().show(mob,revealI,this,CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,L("<S-NAME> <S-IS-ARE> almost done revealing <T-NAME>."));
				else
				if((tickUp%4)==0)
				{
					final int total=tickUp+tickDown;
					final int pct=(int)Math.round(CMath.div(tickUp,total)*100.0);
					mob.location().show(mob,revealI,this,CMMsg.MSG_DELICATE_SMALL_HANDS_ACT,L("<S-NAME> continue(s) revealing <T-NAME> (@x1% completed).",""+pct),null,L("<S-NAME> continue(s) decrypting <T-NAME>."));
				}
			}
		}
		return true;
	}
	
	@Override
	public void unInvoke()
	{
		final Physical P=affected;
		confirmSuccess();
		super.unInvoke();
		if(P instanceof MOB)
		{
			final MOB mob=(MOB)P;
			if(!success)
			{
				mob.tell(L("You've failed to reveal the text on @x1.",revealI.name(mob)));
			}
			else
			{
				mob.tell(L("You've completed revealing the text on @x1.",revealI.name(mob)));
				boolean killInvisibleInk=false;
				Ability encryptA=mob.fetchEffect("InvisibleInk");
				if(encryptA==null)
				{
					encryptA=revealI.fetchEffect("InvisibleInk");
					if(encryptA!=null)
					{
						killInvisibleInk=true;
						encryptA=(Ability)encryptA.copyOf();
{'fraction_non_alphanumeric': 0.12433679354094579, 'fraction_numerical': 0.0057670126874279125, 'mean_word_length': 4.124704491725768, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6100245', 'n_tokens_mistral': 3551, 'n_tokens_neox': 3057, 'n_words': 644}