MCPcopy Create free account
hub / github.com/catabriga/graphwar / getCurrentFunctionPosition

Method getCurrentFunctionPosition

src/Graphwar/GameData.java:973–1027  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

971 }
972
973 public synchronized int getCurrentFunctionPosition()
974 {
975 if(exploding)
976 {
977 return function.getNumSteps();
978 }
979
980 int numDrawSteps = (int)((System.currentTimeMillis() - timeStartedDrawingFunction)*Constants.FUNCTION_VELOCITY)/1000;
981
982 if(numDrawSteps > function.getNumSteps() && drawingFunction)
983 {
984 numDrawSteps = function.getNumSteps();
985
986 exploding = true;
987 timeStartedExploding = System.currentTimeMillis();
988
989 if(isFunctionReversed())
990 {
991 obstacle.setExplosion(Constants.PLANE_LENGTH - (int)function.getLastX(), (int)function.getLastY(), Constants.EXPLOSION_RADIUS);
992 }
993 else
994 {
995 obstacle.setExplosion((int)function.getLastX(), (int)function.getLastY(), Constants.EXPLOSION_RADIUS);
996 }
997
998 obstacle.explodePoint();
999 //this.drawingFunction = false;
1000 //nextTurn();
1001 }
1002
1003 ListIterator<Soldier> itr = soldiersHit.listIterator();
1004
1005 while(itr.hasNext())
1006 {
1007 Soldier soldier = itr.next();
1008
1009 if(soldier.isAlive() == true)
1010 {
1011 if(soldier.isExploding())
1012 {
1013 if(soldier.getTimeExploding() > Constants.SOLDIER_MAX_DEATH_TIME)
1014 {
1015 soldier.setExploding(false);
1016 }
1017 }
1018 else if(numDrawSteps > soldier.getKillPosition())
1019 {
1020 soldier.setExploding(true);
1021 soldier.setAlive(false);
1022 }
1023 }
1024 }
1025
1026 return numDrawSteps;
1027 }
1028
1029 private void processFunction(Player player, String functionString) throws MalformedFunction
1030 {

Callers 2

updateDrawingStuffMethod · 0.95
drawFunctionImageMethod · 0.80

Calls 12

isFunctionReversedMethod · 0.95
isAliveMethod · 0.95
isExplodingMethod · 0.95
getTimeExplodingMethod · 0.95
setExplodingMethod · 0.95
getKillPositionMethod · 0.95
setAliveMethod · 0.95
getNumStepsMethod · 0.80
setExplosionMethod · 0.80
getLastXMethod · 0.80
getLastYMethod · 0.80
explodePointMethod · 0.80

Tested by

no test coverage detected