Commit 146cc09e authored by bozimmerman's avatar bozimmerman

Moves now required to push/pull

git-svn-id: svn://192.168.1.10/public/CoffeeMud@15456 0d6f1817-ed0e-0410-87c9-987e46238f29
parent 77792b2c
......@@ -108,6 +108,7 @@ public class Pull extends Go
else
if(pullThis instanceof MOB)
CMLib.tracking().walk((MOB)pullThis,dirCode,((MOB)pullThis).isInCombat(),false,true,true);
mob.curState().adjMovement(-pullThis.phyStats().movesReqToPull(), mob.maxState());
}
}
}
......
......@@ -105,7 +105,9 @@ public class Push extends Go
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
if((dir.length()>0)&&(msg.tool() instanceof Room)&&(msg.tool()!=mob.location()))
if((dir.length()>0)
&&(msg.tool() instanceof Room)
&&(msg.tool()!=mob.location()))
{
final Room R=(Room)msg.tool();
if(R.okMessage(mob,msg))
......@@ -126,6 +128,7 @@ public class Push extends Go
else
if(pushThis instanceof MOB)
CMLib.tracking().walk((MOB)pushThis,dirCode,((MOB)pushThis).isInCombat(),false,true,true);
mob.curState().adjMovement(-pushThis.phyStats().movesReqToPush(), mob.maxState());
}
}
}
......
......@@ -293,6 +293,18 @@ public class DefaultPhyStats implements PhyStats
return Arrays.binarySearch(ambiances, ambiance.trim(), ambiComp) >=0;
}
@Override
public int movesReqToPull()
{
return 1 + (weight() / 3);
}
@Override
public int movesReqToPush()
{
return 1 + (weight() / 3);
}
@Override
public CMObject newInstance()
{
......
......@@ -145,6 +145,21 @@ public interface PhyStats extends CMCommon, Modifiable
*/
public void setWeight(int newWeight);
/**
* Returns the number of move points required to pull
* It is derived from the weight.
* @return the weight of this Physical
*/
public int movesReqToPull(); // items, mobs
/**
* Returns the number of move points required to push
* It is derived from the weight.
* @return the weight of this Physical
*/
public int movesReqToPush(); // items, mobs
/**
* Returns the height of this Physical, in inches
* @see com.planet_ink.coffee_mud.Common.interfaces.PhyStats#setHeight(int)
......
......@@ -2463,13 +2463,24 @@ public class StdMOB implements MOB
{
case CMMsg.TYP_PULL:
case CMMsg.TYP_PUSH:
{
if((msg.target() instanceof Physical)
&&((maxCarry()*10)<((Physical)msg.target()).phyStats().weight()))
{
tell(L("That's way too heavy."));
return false;
}
//$FALL-THROUGH$
final int movesReq = (msg.targetMinor()==CMMsg.TYP_PUSH)?
((Physical)msg.target()).phyStats().movesReqToPush():
((Physical)msg.target()).phyStats().movesReqToPull();
if((curState.getMovement()<movesReq)
&&(curState.getMovement()<maxState.getMovement()))
{
tell(L("You don't have enough movement."));
return false;
}
}
//$FALL-THROUGH$
case CMMsg.TYP_GET:
case CMMsg.TYP_REMOVE:
case CMMsg.TYP_OPEN:
......@@ -2914,6 +2925,12 @@ public class StdMOB implements MOB
srcM.tell(srcM, this, null, L("<T-NAME> is too big for you to pull."));
return false;
}
if((srcM.curState().getMovement()<phyStats.movesReqToPull())
&&(srcM.curState().getMovement()<srcM.maxState().getMovement()))
{
srcM.tell(L("You don't have enough movement."));
return false;
}
break;
case CMMsg.TYP_PUSH:
if ((!CMLib.flags().isBoundOrHeld(this)) && (!CMLib.flags().isSleeping(this)))
......@@ -2921,11 +2938,17 @@ public class StdMOB implements MOB
srcM.tell(srcM, this, null, L("You can't do that to <T-NAMESELF>."));
return false;
}
if (phyStats().weight() > srcM.maxCarry())
if (phyStats().weight() > (srcM.maxCarry()/2))
{
srcM.tell(srcM, this, null, L("<T-NAME> is too heavy for you to push."));
return false;
}
if((srcM.curState().getMovement()<phyStats.movesReqToPush())
&&(srcM.curState().getMovement()<srcM.maxState().getMovement()))
{
srcM.tell(L("You don't have enough movement."));
return false;
}
break;
case CMMsg.TYP_MOUNT:
case CMMsg.TYP_DISMOUNT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment