Esempio n. 1
0
void Actor::onCreatureConvinced(const Creature* convincer, const Creature* creature)
{
  if(convincer != this && (isFriend(creature) || isOpponent(creature))){
    updateTargetList();
    updateIdleStatus();
  }
}
Esempio n. 2
0
void Actor::onCreatureFound(Creature* creature, bool pushFront /*= false*/)
{
  if(isFriend(creature)){
    assert(creature != this);
    if(std::find(friendList.begin(), friendList.end(), creature) == friendList.end()){
      creature->addRef();
      friendList.push_back(creature);
    }
  }

  if(isOpponent(creature)){
    assert(creature != this);
    if(std::find(targetList.begin(), targetList.end(), creature) == targetList.end()){
      creature->addRef();
      if(pushFront){
        targetList.push_front(creature);
      }
      else{
        targetList.push_back(creature);
      }
    }
  }

  updateIdleStatus();
}
Esempio n. 3
0
void Animal::startDashToPoint(Vec2 targetPoint, float dashTime)
{
    if (isDead()) {
        return;
    }

    _state = AnimalState::Dash;
    _timeline->play("dash", false);

    _targetPointByDash = targetPoint;
    Vec2 move = targetPoint - this->getPosition();

    if (move.x < 0) {
        _image->setFlippedX(false);
        _backImage->setFlippedX(false);
    } else {
        _image->setFlippedX(true);
        _backImage->setFlippedX(true);
    }

    _stopMoveAction();
    if (isOpponent()) {
        _moveAction = this->runAction(MoveBy::create(dashTime, move));
    } else {
        _moveAction = this->runAction(Sequence::create(
                                          MoveBy::create(dashTime, move),
        CallFunc::create([this]() {
            startWalk();
        }),
        NULL
                                      ));
    }
    _moveAction->retain();
}
Esempio n. 4
0
void Monster::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos,
	const Tile* oldTile, const Position& oldPos, bool teleport)
{
	Creature::onCreatureMove(creature, newTile, newPos, oldTile, oldPos, teleport);
	if(creature == this)
	{
		if(isSummon())
			isMasterInRange = canSee(master->getPosition());

		updateTargetList();
		updateIdleStatus();
	}
	else
	{
		bool canSeeNewPos = canSee(newPos), canSeeOldPos = canSee(oldPos);
		if(canSeeNewPos && !canSeeOldPos)
			onCreatureEnter(const_cast<Creature*>(creature));
		else if(!canSeeNewPos && canSeeOldPos)
			onCreatureLeave(const_cast<Creature*>(creature));

		if(isSummon() && master == creature && canSeeNewPos) //Turn the summon on again
			isMasterInRange = true;

		updateIdleStatus();
		if(!followCreature && !isSummon() && isOpponent(creature)) //we have no target lets try pick this one
			selectTarget(const_cast<Creature*>(creature));
	}
}
Esempio n. 5
0
void Animal::jump(Vec2 target, float height, std::function<void ()> callback)
{
    if (_state == AnimalState::Dead) {
        return;
    }
    _state = AnimalState::Jump;
    float jumpInterval = ZUtil::calcDurationTime(_timeline, "drop");
    this->runAction(Sequence::create(
                        JumpTo::create(1.0f, target, height, 1),
    CallFunc::create([this, callback] {
        if (callback) {
            callback();
        }
        _timeline->play("drop", false);
    }),
    DelayTime::create(jumpInterval),
    CallFunc::create([this] {
        if (isOpponent() == false) {
            startWalk();
        }
    }),
    NULL
                    ));

    if (SceneManager::getInstance()->isNetwork() == false) {
        auto maxRank = getMaxSizeRank();
        auto minRank = getMinSizeRank();
        SizeRank rank = SizeRank::None;
        Sprite* crown = nullptr;
        if (maxRank != SizeRank::None) {
            crown = Sprite::create(StringUtils::format("ui/max_crown%d.png", maxRank));
            rank = maxRank;
        } else if (minRank != SizeRank::None) {
            crown = Sprite::create(StringUtils::format("ui/min_crown%d.png", minRank));
            rank = minRank;
        }
        if (crown) {
            //
            WorldManager::getInstance()->appearCrown(rank);

            float size = 0.8f;
            if (rank == SizeRank::Gold) {
                size = 1.2f;
            }
            float scale = size / (getScale() * getParent()->getScale());
            crown->setScale(0);
            crown->setPosition(Vec2(200, 400));
            addChild(crown);
            crown->runAction(Sequence::create(
                                 DelayTime::create(1.0f),
                                 EaseBackOut::create(ScaleTo::create(1.0f, scale)),
                                 DelayTime::create(0.5f),
                                 EaseBackIn::create(ScaleTo::create(0.5f, 0)),
                                 RemoveSelf::create(),
                                 NULL
                             ));
        }
    }
}
Esempio n. 6
0
void Monster::onCreatureConvinced(const Creature* convincer, const Creature* creature)
{
	if(convincer == this || (!isFriend(creature) && !isOpponent(creature)))
		return;

	updateTargetList();
	updateIdleStatus();
}
Esempio n. 7
0
void Animal::startWalk()
{
    if (isDead() || isOpponent()) {
        return;
    }

    Vec2 targetP = WorldManager::getInstance()->getRadomPlace();
    auto speed = getSpeed();
    startWalk(targetP, speed);
}
void Monster::onCreatureConvinced(const Creature* convincer, const Creature* creature)
{
	if(convincer != this && (isFriend(creature) || isOpponent(creature))){
		updateTargetList();
		updateIdleStatus();
	}
	#ifdef __MIN_PVP_LEVEL_APPLIES_TO_SUMMONS__
	g_game.forceClientsToReloadCreature(creature);
	#endif
}
Esempio n. 9
0
void Monster::onCreatureFound(Creature* creature, bool pushFront/* = false*/)
{
	if (isFriend(creature)) {
		addFriend(creature);
	}

	if (isOpponent(creature)) {
		addTarget(creature, pushFront);
	}

	updateIdleStatus();
}
Esempio n. 10
0
void Actor::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos,
  const Tile* oldTile, const Position& oldPos, bool teleport)
{
  Creature::onCreatureMove(creature, newTile, newPos, oldTile, oldPos, teleport);

  if(creature == this){
    if(isSummon()){
      isMasterInRange = canSee(getMaster()->getPosition());
    }

    updateTargetList();
    updateIdleStatus();

    /*
    TODO: Optimizations here
    if(teleport){
      //do a full update of the friend/target list
    }
    else{
      //partial update of the friend/target list
    }
    */
  }
  else{
    bool canSeeNewPos = canSee(newPos);
    bool canSeeOldPos = canSee(oldPos);

    if(canSeeNewPos && !canSeeOldPos){
      onCreatureEnter(const_cast<Creature*>(creature));
    }
    else if(!canSeeNewPos && canSeeOldPos){
      onCreatureLeave(const_cast<Creature*>(creature));
    }

    if(isSummon() && getMaster() == creature){
      if(canSeeNewPos){
        //Turn the summon on again
        isMasterInRange = true;
      }
    }

    updateIdleStatus();

    if(!followCreature && !isSummon()){
      //we have no target lets try pick this one
      if(isOpponent(creature)){
        selectTarget(const_cast<Creature*>(creature));
      }
    }
  }
}
Esempio n. 11
0
File: fight.cpp Progetto: q4a/attal
void Fight::slot_mouseMoved( FightCell * cell, bool isUnit )
{
	if( !cell) {
		setCursor( Qt::ArrowCursor );
		return;
	}

	if( cell) {
		_currentCell = cell;
		_isUnit = isUnit;
	}

	if( _currentCell ) {
#ifdef QT_DEBUG
		QString msg;
		msg = QString(tr("Cell: row %1, col %2, coordinates x %3, y %4 ")).arg(_currentCell->getRow()).arg(_currentCell->getCol()).arg(_currentCell->x()).arg( _currentCell->y());

		emit sig_statusMsg( msg );
#endif 

		GenericFightUnit * unit = _currentCell->getUnit();
		AttalCommon::FightCellAccess access = _currentCell->getAccess();

		if( unit ) {
			if( unit == _activeUnit ) {
				setCursor( Qt::WaitCursor );
			} else if ( !isOpponent(unit) ){
				setCursor( Qt::ForbiddenCursor );
			} else {
				if( access == AttalCommon::FAR_OCCUPIED ) {
					if ( _activeUnit->isDistAttack() && _isUnit ) {
						setCursor( Qt::PointingHandCursor );
					} else {
						setCursor( Qt::ForbiddenCursor );
					}
				} else if ( access == AttalCommon::NEAR_OCCUPIED && _isUnit ) {
					setCursor( Qt::PointingHandCursor );
				} else {
					setCursor( Qt::ArrowCursor );
				}
			}
		} else if ( access == AttalCommon::NEAR_FREE ) {
			setCursor( Qt::ArrowCursor );
		} else {
			setCursor( Qt::ForbiddenCursor );
		}
	} else {
		setCursor( Qt::ForbiddenCursor );
	}

}
Esempio n. 12
0
void Monster::onCreatureLeave(Creature* creature)
{
#ifdef __DEBUG__
	std::clog << "onCreatureLeave - " << creature->getName() << std::endl;
#endif
	if(isSummon() && master == creature)
	{
		if(!g_config.getBool(ConfigManager::TELEPORT_SUMMONS) && (!master->getPlayer()
			|| !g_config.getBool(ConfigManager::TELEPORT_PLAYER_SUMMONS)))
		{
			//Turn the monster off until its master comes back
			isMasterInRange = false;
			updateIdleStatus();
		}
		else if(!doTeleportToMaster())
			teleportToMaster = true;
	}

	//update friendList
	if(isFriend(creature))
	{
		CreatureList::iterator it = std::find(friendList.begin(), friendList.end(), creature);
		if(it != friendList.end())
		{
			(*it)->unRef();
			friendList.erase(it);
		}
#ifdef __DEBUG__
		else
			std::clog << "Monster: " << creature->getName() << " not found in the friendList." << std::endl;
#endif
	}

	//update targetList
	if(isOpponent(creature))
	{
		CreatureList::iterator it = std::find(targetList.begin(), targetList.end(), creature);
		if(it != targetList.end())
		{
			(*it)->unRef();
			targetList.erase(it);
			if(targetList.empty())
				updateIdleStatus();
		}
#ifdef __DEBUG__
		else
			std::clog << "Player: " << creature->getName() << " not found in the targetList." << std::endl;
#endif
	}
}
Esempio n. 13
0
void Animal::fight(AbstractBattleEntity* entity)
{
    if (canAttack() == false) {
        return;
    }

    _state = AnimalState::Battle;
    _target = entity;
    _target->retain();

    Vec2 originPoint = getPosition();
    Vec2 targetPoint = ZMath::divideInternally(getPosition(), entity->getPosition(), 1, 2);
    auto size = _image->getContentSize() * getScale();
    Vec2 effectPoint = ZMath::divideInternally(getPosition(), entity->getPosition(), 1, 1) + Vec2(0, size.height / 2);

    _timeline->play("default", false);
    _stopMoveAction();
    _moveAction = runAction(RepeatForever::create(Sequence::create(
                                MoveTo::create(0.1f, targetPoint),
    CallFunc::create([this, effectPoint]() {
        // sound effect
        if (isEnemy() || isOpponent()) {
            SoundManager::getInstance()->playFight2Sound();
        } else {
            SoundManager::getInstance()->playFightSound();
        }

        // particle effect
        auto effect = ParticleSystemQuad::create("effect/hit3.plist");
        effect->setScale(getScale());
        effect->setPosition(effectPoint);
        effect->setZOrder(100000);
        effect->setAutoRemoveOnFinish(true);
        auto parent = getParent();
        if (parent) {
            parent->addChild(effect);
        }
    }),
    MoveTo::create(0.3f, originPoint),
    DelayTime::create(0.5f),
    NULL
                            )));
    _moveAction->retain();

    if (startFightCallback) {
        startFightCallback(this, _target);
    }
}
Esempio n. 14
0
void Animal::startDash(Vec2 targetPoint, Length speed)
{
    if (isDead()) {
        return;
    }

    if (_state != AnimalState::Dash) {
        _state = AnimalState::Dash;
        _timeline->play("dash", true);
    } else {
        if ((_targetPointByDash - targetPoint).length() < 30) {
            return;
        }
    }

    _targetPointByDash = targetPoint;
    float s = speed.getDisplayLength();
    Vec2 move = targetPoint - this->getPosition();

    if (speed.getMmLength() == 0) {
        return;
    }

    float duration = move.length() / s;
    if (move.x < 0) {
        _image->setFlippedX(false);
        _backImage->setFlippedX(false);
    } else {
        _image->setFlippedX(true);
        _backImage->setFlippedX(true);
    }

    _stopMoveAction();
    if (isOpponent()) {
        _moveAction = this->runAction(MoveBy::create(duration, move));
    } else {
        _moveAction = this->runAction(Sequence::create(
                                          MoveBy::create(duration, move),
        CallFunc::create([this]() {
            startFreeAction();
        }),
        NULL
                                      ));
    }
    _moveAction->retain();
}
Esempio n. 15
0
void Monster::onCreatureLeave(Creature* creature)
{
	// std::cout << "onCreatureLeave - " << creature->getName() << std::endl;

	if(getMaster() == creature)
	{
		//Turn the monster off until its master comes back
		isMasterInRange = false;
		updateIdleStatus();
	}

	//update friendList
	if(isFriend(creature))
	{
		CreatureList::iterator it = std::find(friendList.begin(), friendList.end(), creature);
		if(it != friendList.end())
		{
			(*it)->releaseThing2();
			friendList.erase(it);
		}
#ifdef __DEBUG__
		else
			std::cout << "Monster: " << creature->getName() << " not found in the friendList." << std::endl;
#endif
	}

	//update targetList
	if(isOpponent(creature))
	{
		CreatureList::iterator it = std::find(targetList.begin(), targetList.end(), creature);
		if(it != targetList.end())
		{
			(*it)->releaseThing2();
			targetList.erase(it);
			if(targetList.empty())
				updateIdleStatus();
		}
#ifdef __DEBUG__
		else
			std::cout << "Player: " << creature->getName() << " not found in the targetList." << std::endl;
#endif
	}
}
Esempio n. 16
0
File: fight.cpp Progetto: q4a/attal
void Fight::setActive( CLASS_FIGHTER cla, int num )
{
	TRACE("set active cla %d, num %d", cla, num);
	if( _activeUnit ) {
		_activeUnit->setActive( false );
	}
	
	if( cla == FIGHTER_ATTACK ) {
		_activeUnit = _unitsAtt[num];
		
		if( _isAttack ) {
			_isActive = true;
		} else {
			_isActive = false;
			_map->clearPath();
		}
	} else {
		_activeUnit = _unitsDef[num];
		
		if( _isAttack ) {
			_isActive = false;
			_map->clearPath();
		} else {
			_isActive = true;
		}
	}

	_activeUnit->setActive( true );

	if( !isOpponent( _activeUnit ) ) {
		setUnitsAlpha( true );
		_activeUnit->setAlpha( false );
	} else {
		setUnitsAlpha( false );
	}

	if( _isActive ) {
		_map->initPath( _activeUnit );
		slot_mouseMoved( _currentCell, true );
		///_map->printPath();
	}
}
Esempio n. 17
0
File: fight.cpp Progetto: q4a/attal
void Fight::slot_mouseLeftPressed( FightCell * cell )
{
	if( _activeUnit && _isActive ) {
		switch( cell->getAccess() ) {
		case NEAR:
			moveUnit( cell );
			break;
		case NEAR_OCCUPIED:
			moveUnit( cell );
			break;
		case FAR_OCCUPIED:
			if( ( _activeUnit->getDistAttack() > 0 ) && ( isOpponent( cell->getUnit() ) ) ) {
				_socket->sendFightDistAttack( giveClass( cell->getUnit() ), giveNum( cell->getUnit() ) );
				_socket->sendFightUnitEndMove();
			}
			break;
		default:
			break;
		}
	}
}
Esempio n. 18
0
void Monster::onCreatureLeave(Creature* creature)
{
	// std::cout << "onCreatureLeave - " << creature->getName() << std::endl;

	if (getMaster() == creature) {
		//Take random steps and only use defense abilities (e.g. heal) until its master comes back
		isMasterInRange = false;
	}

	//update friendList
	if (isFriend(creature)) {
		removeFriend(creature);
	}

	//update targetList
	if (isOpponent(creature)) {
		removeTarget(creature);
		if (targetList.empty()) {
			updateIdleStatus();
		}
	}
}
Esempio n. 19
0
void Animal::startStop()
{
    if (isDead()) {
        return;
    }

    if (_state != AnimalState::Stop) {
        _state = AnimalState::Stop;
        _timeline->play("stop", true);
    }

    if (isOpponent() == false) {
        _stopMoveAction();
        _moveAction = runAction(Sequence::create(
                                    DelayTime::create(1.5f),
        CallFunc::create([this] {
            startFreeAction();
        }),
        NULL
                                ));
        _moveAction->retain();
    }
}
Esempio n. 20
0
File: fight.cpp Progetto: q4a/attal
void Fight::slot_mouseLeftPressed( FightCell * cell, bool isUnit )
{

	AttalPopup * popup = this->findChild<AttalPopup *>("AttalFightPopup");
	
	if( popup && popup->isVisible() ) {
		popup->hide();
		popup->setType();
		return;
	}

	AttalCommon::FightCellAccess access = cell->getAccess();
	TRACE("left pressed cell access %d, active unit %p , isActive %d", access, _activeUnit, _isActive);
	TRACE("cell->getUnit %p, isUnit %d dist %d", cell->getUnit(), isUnit, cell->getDist() );
	TRACE("cell row %d, col %d", cell->getRow(), cell->getCol() );
	
	GenericFightCell * neib = NULL;
	GenericFightUnit * oppunit = cell->getUnit();

	if( oppunit && !isOpponent( oppunit )  ) {
		return;
	}
	
	if( _activeUnit && _isActive ) {

		switch( access ) {
			case AttalCommon::NEAR_FREE :
				TRACE("NEAR_FREE");
				moveUnit( cell );
				break;
			case AttalCommon::NEAR_OCCUPIED:
				TRACE("NEAR_OCCUPIED");
				if( _activeUnit->getDistAttack() > 0 && oppunit ) {
					_socket->sendFightDistAttack( giveClass( oppunit ), giveNum( oppunit ) );
					_socket->sendFightUnitEndMove();
				} else if ( oppunit  ) {
					moveUnit( cell );
				} else {
					neib = _map->getHeadCell( cell ,_activeUnit->isLookingToRight() );

					if( neib ) {
						oppunit = neib->getUnit();
						if ( ( oppunit ) && ( isOpponent ( oppunit  ) ) ) {
							moveUnit( neib );
						}
					}
				}
				break;
			case AttalCommon::FAR_OCCUPIED:
				TRACE("FAR_OCCUPIED");
				if( ( oppunit ) && ( _activeUnit->getDistAttack() > 0 ) ) {
					_socket->sendFightDistAttack( giveClass( oppunit ), giveNum( oppunit ) );
					_socket->sendFightUnitEndMove();
				} else {
					neib = _map->getHeadCell( cell , !_activeUnit->isLookingToRight() );
					if( neib ) {
						oppunit = neib->getHeadUnit();
						if( oppunit && neib->getAccess()== AttalCommon::NEAR_OCCUPIED  && ( isOpponent ( oppunit  ) ) ) {
							moveUnit( neib );
						}
					}
				}
				break;
			default:
				break;
		}
	}
}
Esempio n. 21
0
void Monster::onCreatureMove(Creature* creature, const Tile* newTile, const Position& newPos,
                             const Tile* oldTile, const Position& oldPos, bool teleport)
{
	Creature::onCreatureMove(creature, newTile, newPos, oldTile, oldPos, teleport);

	if (mType->info.creatureMoveEvent != -1) {
		// onCreatureMove(self, creature, oldPosition, newPosition)
		LuaScriptInterface* scriptInterface = mType->info.scriptInterface;
		if (!scriptInterface->reserveScriptEnv()) {
			std::cout << "[Error - Monster::onCreatureMove] Call stack overflow" << std::endl;
			return;
		}

		ScriptEnvironment* env = scriptInterface->getScriptEnv();
		env->setScriptId(mType->info.creatureMoveEvent, scriptInterface);

		lua_State* L = scriptInterface->getLuaState();
		scriptInterface->pushFunction(mType->info.creatureMoveEvent);

		LuaScriptInterface::pushUserdata<Monster>(L, this);
		LuaScriptInterface::setMetatable(L, -1, "Monster");

		LuaScriptInterface::pushUserdata<Creature>(L, creature);
		LuaScriptInterface::setCreatureMetatable(L, -1, creature);

		LuaScriptInterface::pushPosition(L, oldPos);
		LuaScriptInterface::pushPosition(L, newPos);

		if (scriptInterface->callFunction(4)) {
			return;
		}
	}

	if (creature == this) {
		if (isSummon()) {
			isMasterInRange = canSee(getMaster()->getPosition());
		}

		updateTargetList();
		updateIdleStatus();
	} else {
		bool canSeeNewPos = canSee(newPos);
		bool canSeeOldPos = canSee(oldPos);

		if (canSeeNewPos && !canSeeOldPos) {
			onCreatureEnter(creature);
		} else if (!canSeeNewPos && canSeeOldPos) {
			onCreatureLeave(creature);
		}

		if (canSeeNewPos && isSummon() && getMaster() == creature) {
			isMasterInRange = true;    //Follow master again
		}

		updateIdleStatus();

		if (!isSummon()) {
			if (followCreature) {
				const Position& followPosition = followCreature->getPosition();
				const Position& position = getPosition();

				int32_t offset_x = Position::getDistanceX(followPosition, position);
				int32_t offset_y = Position::getDistanceY(followPosition, position);
				if ((offset_x > 1 || offset_y > 1) && mType->info.changeTargetChance > 0) {
					Direction dir = getDirectionTo(position, followPosition);
					const Position& checkPosition = getNextPosition(dir, position);

					Tile* tile = g_game.map.getTile(checkPosition);
					if (tile) {
						Creature* topCreature = tile->getTopCreature();
						if (topCreature && followCreature != topCreature && isOpponent(topCreature)) {
							selectTarget(topCreature);
						}
					}
				}
			} else if (isOpponent(creature)) {
				//we have no target lets try pick this one
				selectTarget(creature);
			}
		}
	}
}
Esempio n. 22
0
/* ---------------------------------------------------------------------------*/
int isKnightMovable(char *board , char sourceCol, int sourceRow, 
char targetCol, int targetRow)
{
	/* Return value, represents validness of move */
	int returnValue;
	
	/* A free knight can make 8 different moves; 2 forwards, 2 backwards, */
	/* 2 left and 2 right */
	int firstMove;
	int secondMove;
	int thirdMove;
	int fourthMove;
	int fifthMove;
	int sixthMove;
	int seventhMove;
	int eighthMove;
	
	/* Constant variables to find row number of the valid target cell */
	int firstConstant;
	int secondConstant;
	int thirdConstant;
	int fourthConstant;
	
	/* Indexes of first and target cells */
	int sourceIndex;
	int targetIndex;
	
	/* Piece variables for the first and target cell */
	char piece;
	char targetPiece;
	
	/* Variable for the control of the target cells occupier */
	int opponentValue;
	
	/* Setting returnValue to 0. Program will change it to 1 if the move */
	/* is valid and available after the controls */
	returnValue = 0;
	
	
	/* Target must be a row front of the pawn */
	/* Finding the first and target cells index on the board */
	sourceIndex = positionFinder(sourceCol,sourceRow);
	targetIndex = positionFinder(targetCol,targetRow);
	
	
	/* Finding the pieces to learn if first piece is white or black */
	/* and if target cell is valid to move */
	piece = pieceFinder(board,sourceIndex);
	targetPiece = pieceFinder(board,targetIndex);
	
	
	/* If target piece is opponent then function will return 1, if it is ally */
	/* it will return 0 otherwise which means it's ' ' (blank) cell return -1 */
	opponentValue = isOpponent(piece,targetPiece);
	
	/* Top cells */
	firstMove = sourceIndex - 15;
	secondMove = sourceIndex - 17;
	firstConstant = (sourceIndex - 16)/8;
	
	/* Upper cells */
	thirdMove = sourceIndex - 10;
	fourthMove = sourceIndex - 6;
	secondConstant = (sourceIndex - 8)/8;
	
	/* Downside cells */
	fifthMove = sourceIndex + 6;
	sixthMove = sourceIndex + 10;
	thirdConstant = (sourceIndex + 8)/8;
	
	/* Bottom cells */
	seventhMove = sourceIndex + 15;
	eighthMove = sourceIndex + 17;
	fourthConstant = (sourceIndex + 16)/8;
	
	
	/* If target cell is a movable cell */
	if (opponentValue != 0)
	{
		/* Checking if target cell is on same row with top movable cells */
		if (firstConstant == targetIndex/8)
		{
			/* If rows match then compare cells */
			if (firstMove == targetIndex)
			{
				returnValue = 1;
			}

			else if (secondMove == targetIndex)
			{
				returnValue = 1;
			}
		}
		
		/* Checking if target cell is on same row with upper movable cells */
		else if (secondConstant == targetIndex/8)
		{
			/* If rows match then compare cells */
			if (thirdMove == targetIndex)
			{
				returnValue = 1;
			}
		
			else if (fourthMove == targetIndex)
			{
				returnValue = 1;
			}
		}
		
		/* Checking if target cell is on same row with downside movable cells */
		else if (thirdConstant == targetIndex/8)
		{
			/* If rows match then compare cells */
			if (fifthMove == targetIndex)
			{
				returnValue = 1;
			}
		
			else if (seventhMove == targetIndex)
			{
				returnValue = 1;
			}
		}
		
		/* Checking if target cell is on same row with bottom movable cells */
		else if (fourthConstant == targetIndex/8)
		{
			/* If rows match then compare cells */
			if (sixthMove == targetIndex)
			{
				returnValue = 1;
			}
			
			else if (eighthMove == targetIndex)
			{
				returnValue = 1;
			}
		}
	}
	return (returnValue);
}